Getting the version of an Ansible Galaxy role

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

nothing internal, you'll have to shell out to use `ansilbe-galaxy info
<role> --offline`

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

if they are your roles a _rolname_version in vars/main.yml would be a
good workaround.