vendredi 23 septembre 2022

Ansible: How to specify 'hosts:' value with patterns?

I have an inventory file that is dynamically generated with stanzas/groups in it. For example:

[ABC_foo_something]
server1
server2

[ABC_foo_somethingelse]
server3
server4

[ABC_bar_otherthing]
server5
server6

How can I specify a pattern for my playbook to run on e.g. all ABC_foo* groups.

---
- name: some playbook
  hosts: ABC_foo*
  tasks: etc..etc..

The problem is that the entire string is not known because they are dynamically created. I only know the first few chunks of the pattern and the rest should be wildcarded somehow.

Aucun commentaire:

Enregistrer un commentaire