Example:
I have a host group webservers with 30 hosts. I have 6 playbooks which have "hosts: webservers". I have a new host which I need to configure, and I add it to the webservers group. I have a meta-playbook named baseline-web.yml which includes the 6 playbooks. The meta playbook also has the hosts: webservers.
Now when executing it does all the actions on all the host, but the changes are only on the newly added host.
Can I give a parameter to the "ansible-playbook" program which overrules the defined hosts: variable?
Like: ~$ ansible-playbook --hosts=newserver5 playbooks/baseline-web.yml
(Which then would only run on newserver5, including all included playbooks)
@RaymiiOrg You can use --limit
(a.k.a. -l
) to limit hosts on which you playbook is run, e.g. :
ansible-playbook -l newserver5 playbooks/baseline-web.yml
Also, I don't think - hosts:
can appear twice, so having host
in the top AND in the sub-playbooks is not valid AFAIK.
Questions should go to the mailing list, not the bug tracker.
Thanks both. Next time I'll go to the mailing list.
Most helpful comment
@RaymiiOrg You can use
--limit
(a.k.a.-l
) to limit hosts on which you playbook is run, e.g. :ansible-playbook -l newserver5 playbooks/baseline-web.yml
Also, I don't think
- hosts:
can appear twice, so havinghost
in the top AND in the sub-playbooks is not valid AFAIK.