Filter hosts matching groups

33 views
Skip to first unread message

Bruno Cochofel

unread,
Jan 22, 2019, 2:00:03 AM1/22/19
to Ansible Project
Hi all,

I have a custom CMDB and I've created a script for dynamic inventory. On that script I have grouped hosts using several ways, just like VMware dynamic inventory script.

My question is, how can I match using more then one group? Something like, I want to deploy to all Linux, that are in the prd group but only the ones that are also in the data center X.
Is this possible?

Thanks,
Bruno

Kai Stian Olstad

unread,
Jan 22, 2019, 2:36:27 PM1/22/19
to ansible...@googlegroups.com
It shouldn't be a problem check at patterns
https://docs.ansible.com/ansible/latest/user_guide/intro_patterns.html

--
Kai Stian Olstad


Bruno Cochofel

unread,
Jan 22, 2019, 6:03:25 PM1/22/19
to ansible...@googlegroups.com
Hi,

Thanks Kai, I will give it a try.

Bruno

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/pMCc8MQss14/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@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/2683497.Q3SgnEEzWG%40x1.
For more options, visit https://groups.google.com/d/optout.

Tony Chia

unread,
Jan 22, 2019, 11:37:33 PM1/22/19
to Ansible Project
Try this in your playbook

hosts: linux:&prod:&datacenter_x

Reply all
Reply to author
Forward
0 new messages