Can't run Ansible in daemon-mode

我怕爱的太早我们不能终老 提交于 2019-12-11 03:07:15

问题


Can I run Ansible to manage my hosts like a daemon? For example, I sometimes change my playbooks and I don't want to run "ansible-playbook main.yml" manually. Please, don't propose crontab. There is a specific point and I can't use crontab on production server.

Thank you


回答1:


What you are talking about here is called pull mode. Architectually Ansible is designed to work in push mode - you push changes to server from a control machine.

If you really would like to make Ansible work in pull mode then you can do so with Ansible-Pull script, see docs here: http://docs.ansible.com/playbooks_intro.html#ansible-pull

Ansible-pull is a script that can fetch your configuration playbooks from remote repository and run them against localhost. Ansible-pull does not however solve a problem of checking for a new configuration changes - you need to solve it yourself with cron.

Another alternative is using Ansible Tower (you need a paid license for it). Ansible Tower supports callbacks via API, so the server you want to configure has to do API request to Ansible Tower server, Tower in turn will check whether the host that sent API request is in its inventory. If it's in inventory then Tower will start configuring it.



来源:https://stackoverflow.com/questions/27295348/cant-run-ansible-in-daemon-mode

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