Run once on multiple Inventory Hosts with same ansible_host value

19 views
Skip to first unread message

Kevin Knox

unread,
Oct 11, 2023, 3:46:25 PM10/11/23
to Ansible Project
I am importing my inventory from ServiceNow, so I have to go with what I'm given. I'm given multiple WebLogic Nodes per individual server, that is per ansible_host. I'd like the user to be able to pull all Inventory Hosts, but have the process run once per "ansible_host" sometimes and other times have the process run against each Inventory Host separately, so multiple times per ansible_host. 

Is this possible without writing a "lock file" solution?

Thank you. 

Brian Coca

unread,
Oct 11, 2023, 4:20:35 PM10/11/23
to ansible...@googlegroups.com
No need for lockfiles, I would use groups instead. Setup a group that
has one instance of inventory_hostname per ansible_host, then target
that group when you want to do 'single operation per real host'. for
'all' just use the all group.



--
----------
Brian Coca

Kevin Knox

unread,
Oct 11, 2023, 7:15:13 PM10/11/23
to ansible...@googlegroups.com
Lovely idea! Thank you!

Kevin


Sent from my iPhone

> On Oct 11, 2023, at 4:20 PM, Brian Coca <bc...@redhat.com> wrote:
>
> No need for lockfiles, I would use groups instead. Setup a group that
> --
> 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/pdPuYiwvYgE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CACVha7ccefymuN9Q%2B89uQVa2%3Dhgttf8hAKsfwVXyqm1wij_9QA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages