Re: [ansible-project] opposite of --limit (to exclude hosts)
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. -- -- Brian Coca -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CACVha7f2QPN0FCWZi5B_18R527hN7oR3dQd%2B3t7zucQWEAcp0Q%40mail.gmail.com.
Re: [ansible-project] opposite of --limit (to exclude hosts)
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 > On 04/27/2023 10:59 AM CEST 'Felix Fontein' via Ansible Project > wrote: > > > 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 > > -- > 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 ansible-project+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/20230427105954.1e062727%40rovaniemi. --- gunnar wagner | fichtestr. 1, 19386 lübz | fon: 0176 7808 9090 -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2110359943.1214935.1682603122008%40office.mailbox.org.
Re: [ansible-project] opposite of --limit (to exclude hosts)
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 -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/20230427105954.1e062727%40rovaniemi.
[ansible-project] opposite of --limit (to exclude hosts)
ist there anything like a negation of --limit (to not execute a playbook on the named remotes) ? -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/799453217.1177376.1682581887195%40office.mailbox.org.