Hello,
In the Ansible Roles documentation it's written;
"While it’s probably not something you should do often, you can also
conditionally apply roles like so:"
---
- hosts: webservers
roles:
- { role: some_role, when: "ansible_os_family == 'RedHat'" }
It seems conditional roles is the only way to have a unique playbook
executing differentes installations concidering targeted servers types.
for instance, for kubernetes install:
- hosts:all
roles :
- { role: install_master, when: "server_type == "master" }
- { role: install_worker, when: "server_type == "worker" }
Then, executing this playbook, i install both the masters and the workers,
instead to have one playbook for each with one hosts group for each.
So conditionnal roles seems pretty important and going to be used very
often.
What i have missed? Is there another way to to this?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/ee60ff79-1970-40c9-b421-5133698f7c00%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.