You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Note: This is a pretty fragile sort. It works for strict semver... mostly, but
# it might not work with more complex use cases, and Galaxy kind of allows
# anything in the version field, so YMMV. It works with geerlingguy.* roles.
- name: Use the ugliest hack in the world to find the highest version.
set_fact:
highest_role_version: >-
{%- for version_data in role_versions | sort(attribute='name', reverse=True) -%}
{%- if loop.first -%}
{{ version_data.name }}
{%- endif -%}
{%- endfor -%}
It shouldn't even be necessary to sort the data; The versions: array is already sorted properly (i.e. the latest version is the first dictionary in the array).
I plan on creating a PR to address this issue and implement some other ideas I have to make the playbook more structurally sound. I will also take a stab at implementing #1.
I implemented a similar solution to find the latest version of a project on Github in one of my Ansible roles. [link]
Thank you again for all your great Ansible content! Watching/reading your educational content and just looking at your open-source Ansible code has been crucial to my Ansible journey.
I just ran this on
drupal-vm
today and got:So... the version comparison is definitely not working as planned.
The text was updated successfully, but these errors were encountered: