Hi all,
Please excuse for my ignorance if there is a clean way to do the following:
hosts
[sm]
host1
[sw]
host2
myplaybook.yml
---
- hosts: all
roles:
- common
- hosts: sm
roles:
- role1
- role2
- hosts: sw
roles:
- role1
- role3
----------------------------
Assume that I can not combine tasks in role1 to common but I want to apply the run at the last play in the play book. What are the options? Since start-at-task will be the same for the role1 I can only start at 2nd play but not the the 3rd play. I certainly can intro a fake role as the first role or a pre-tasks task (have not tried this yet) to the 3rd play to possibly achieve this but that is not the point of how we can achieve this in a more systematic and clean way in Ansible.
I can even break the plays into their own playbooks and then combine into a playbook:
mynewplaybook.yml
---
- include: play1.yml
when: common is defined
- include: play2.yml
when: sm is defined
- include: play3.yml
when: sw is defined
-----
And then use "-e sw=yes" to achieve this or even just create the mynewplaybook.yml or the original playbooks and then comment out the first 2 plays but then again would it be even possible to do start-at-play feature that is much cleaner than what I suggest here.
Please share your better approaches and comments on this.
Thank you very much and Ansible rocks.
Steven.