Discussion:
[ansible-project] when list of strings NOT IN hostname
Chris Short
2015-07-30 14:19:54 UTC
Permalink
I'm trying to get a configuration deployed to a large group of hosts except
for a few specific ones. I am trying very hard to not use an inventory
group to manage this. I've tried a few different methods and cannot seem to
get it to work. Here are examples of what I've tried:

when: '"abc":"def":"ghi" not in inventory_hostname'

when: '"[abc, def, ghi]" not in inventory_hostname'

when: '"{{ item }}" not in inventory_hostname'
with_items:
- abc
- def
- ghi

Thoughts?
--
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+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9082fa7b-2d70-4f65-a377-bd8f3063742b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Timothy Gerla
2015-07-30 14:21:53 UTC
Permalink
I am not sure why you would be avoiding inventory groups, since they're
built for this purpose....but you probably want:

when: "abc" not in inventory_hostname and "def" not in inventory_hostname
and "ghi" not in inventory_hostname

-Tim
Post by Chris Short
I'm trying to get a configuration deployed to a large group of hosts
except for a few specific ones. I am trying very hard to not use an
inventory group to manage this. I've tried a few different methods and
when: '"abc":"def":"ghi" not in inventory_hostname'
when: '"[abc, def, ghi]" not in inventory_hostname'
when: '"{{ item }}" not in inventory_hostname'
- abc
- def
- ghi
Thoughts?
--
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
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/9082fa7b-2d70-4f65-a377-bd8f3063742b%40googlegroups.com
<https://groups.google.com/d/msgid/ansible-project/9082fa7b-2d70-4f65-a377-bd8f3063742b%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAH4wdVWH4vNvbr%3DHbooe5v3hY6WQNz5ETnKpsFdhzchndpOp%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Chris Short
2015-07-30 14:25:45 UTC
Permalink
Thanks, Tim that is very helpful. I have a ton of groups already and am
trying to minimize them and not pile on.

I could do this with host_vars (since it is lines in configuration files
that are different). I didn't think of that until I read your response so I
definitely am thankful.
Post by Timothy Gerla
I am not sure why you would be avoiding inventory groups, since they're
when: "abc" not in inventory_hostname and "def" not in inventory_hostname
and "ghi" not in inventory_hostname
-Tim
Post by Chris Short
I'm trying to get a configuration deployed to a large group of hosts
except for a few specific ones. I am trying very hard to not use an
inventory group to manage this. I've tried a few different methods and
when: '"abc":"def":"ghi" not in inventory_hostname'
when: '"[abc, def, ghi]" not in inventory_hostname'
when: '"{{ item }}" not in inventory_hostname'
- abc
- def
- ghi
Thoughts?
--
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
<javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/9082fa7b-2d70-4f65-a377-bd8f3063742b%40googlegroups.com
<https://groups.google.com/d/msgid/ansible-project/9082fa7b-2d70-4f65-a377-bd8f3063742b%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/e87c0790-4d10-4564-a704-aecd4adcf414%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...