Reputation: 669
When downloading roles it's possible to specify roles. One of several ways would be with the following requirements.yml
file:
---
- src: https://github.com/jdauphant/ansible-role-ssl-certs
version: v1.5.2
This role could then be downloaded with the following command:
ansible-galaxy install -r requirements.yml
How do you then specify which version of a role to use in an Ansible playbook?
roles:
- jdauphant.ssl-certs
Upvotes: 5
Views: 7362
Reputation: 68459
There is no option to save different versions of a playbook under the same name and then to specify which version to run in a playbook.
You can:
"bind" a particular role version to the playbook by downloading out to the roles
subdirectory of the project directory (the one containing the playbook). Ansible will then use this version before trying roles faced in the system roles
directory.
Add path
to the requirements.yml
:
- src: https://github.com/jdauphant/ansible-role-ssl-certs
version: v1.5.2
path: roles/
save different versions under different names (i.e. in different directories) system-wide:
- src: https://github.com/jdauphant/ansible-role-ssl-certs
version: v1.5.2
name: jdauphant.ssl-certs-1.5.2
And reference a particular name:
roles:
- jdauphant.ssl-certs-1.5.2
Upvotes: 5