简体   繁体   中英

Run Ansible Playbooks by region


first of all: I am still an Ansible newbie and I am just getting used to it.

i want to write a playbook that calls up a different playbook depending on the location of the client.

For example:
i have 3 different playbooks specifically for certain regions, usaclient.yml, euclient.yml and asiaclient.yml

these playbooks should be executed automatically via a "master playbook".

if the "master playbook" is executed on a european client, the playbook "euclient.yml" should be started.

does anyone know how to assign playbooks automatically to a region or has an idea how to solve this by bash script?

best regards
D1Ck3n

Q: "If the "master playbook" is executed on a European client, the playbook euclient.yml should be started."

A: In Ansible it's not possible to start a playbook conditionally. See import_playbook .

There are 2 options only. Start the playbook conditionally by an external tool or test the condition inside the playbook. Tryansible-runner .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM