Reload Ansible's dynamic inventory

前端 未结 5 1159
-上瘾入骨i
-上瘾入骨i 2020-12-05 06:43

I\'m using Ansible to setup EC2 instances and deploy an app. There\'s a hosts script which gathers tags related servers and groups info. I\'d like to run these actions as a

5条回答
  •  情深已故
    2020-12-05 07:00

    Ansible currently doesn't support this. If you look at the source code of the ansible or ansible-playbook commands you'll see that the inventory is loaded first and then the inventory object is passed to the ansible command that runs the specified task or playbook. Moving the inventory processing so that it happens within the task/playbook handlers would probably be a pretty major undertaking for a number of reasons.

    Your best bet when doing something like this is to simply break your playbook into two and wrap their calls in a shell script that you only have to invoke once.

提交回复
热议问题