ist there anything like a negation of --limit (to not execute a playbook on the named remotes) ?
Hi,
ist there anything like a negation of --limit (to not execute a
playbook on the named remotes) ?
you can use `!` for that in the `--limit` expression:
`ansible-playbook --limit 'servers,!specific_server,!specific_group ...`
That will use all servers from the group `servers`, except
`specific_server`, and all servers in `specific_group`.
(You can also leave away `servers` to run the playbook on all hosts it
wants to run on, except the ones excluded with `!`.)
Cheers,
Felix
thanks
I can make it work with inline --limit '!specific_server' but could not figure out the right syntax for adresseing a list
'ansible all --limit "@limit.file" -m ping' is waht I am doing
tried several ways for adding the '!' to the above but could not make it work yet
limit will ONLY create a subset of hosts, it will never ADD to the
list of hosts to consider. What you need is to expand your inventory,
which you can do with additional -i entries:
ansible-playbook myplay,yml -i hosts.yml -i 10.0.0.2,10.0.0.3,
This adds 2 hosts to the inventory, but only to the 'all' and
'ungrouped' groups, you would need a custom inventory plugin to add
them to specific groups.