Run Ansible Playbooks by region

 ̄綄美尐妖づ 提交于 2021-01-29 18:57:55

问题



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


回答1:


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. Try ansible-runner.



来源:https://stackoverflow.com/questions/61592342/run-ansible-playbooks-by-region

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!