Getting the version of an Ansible Galaxy role

16 views
Skip to first unread message

Pablo Baeyens

unread,
May 19, 2020, 9:22:30 AM5/19/20
to Ansible Project
Hi,

I want to know the version of a role (from Galaxy) from inside that role (versions correspond to git tags in the source repo).
Is there any special variable I can get with the version of a role being executed?
Any other alternative method of getting this information would also work. 

Thank you in advance,
Pablo

Brian Coca

unread,
May 20, 2020, 11:35:29 PM5/20/20
to Ansible Project
nothing internal, you'll have to shell out to use `ansilbe-galaxy info
<role> --offline`




--
----------
Brian Coca

Pablo Baeyens

unread,
May 22, 2020, 7:25:56 AM5/22/20
to Ansible Project
Okay, thank you for your help! 

I don't think it is the best approach since the output from that command seems meant for humans to read and so there are no guarantees that it will remain as is in future versions, but there does not seem to be an alternative.

Pablo

Brian Coca

unread,
Jun 3, 2020, 10:15:50 AM6/3/20
to Ansible Project
if they are your roles a _rolname_version in vars/main.yml would be a
good workaround.





--
----------
Brian Coca

Reply all
Reply to author
Forward
0 new messages