无法在守护进程模式下运行 Ansible [英] Can't run Ansible in daemon-mode

查看:32
本文介绍了无法在守护进程模式下运行 Ansible的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以运行 Ansible 来像守护进程一样管理我的主机吗?例如,我有时会更改我的剧本,但我不想手动运行ansible-playbook main.yml".请不要推荐 crontab.有一个特定的点,我不能在生产服务器上使用 crontab.

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.

谢谢

推荐答案

你在这里所说的叫做拉模式.从架构上讲,Ansible 旨在在推送模式下工作 - 您可以将更改从控制机器推送到服务器.

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.

如果您真的想让 Ansible 在拉模式下工作,那么您可以使用 Ansible-Pull 脚本来实现,请参阅此处的文档:http://docs.ansible.com/playbooks_intro.html#ansible-pull

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 是一个脚本,它可以从远程存储库中获取您的配置剧本并在本地主机上运行它们.但是,Ansible-pull 并不能解决检查新配置更改的问题 - 您需要使用 cron 自己解决.

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.

另一种选择是使用 Ansible Tower(您需要付费许可证).Ansible Tower 支持通过 API 进行回调,因此您要配置的服务器必须向 Ansible Tower 服务器发出 API 请求,Tower 会依次检查发送 API 请求的主机是否在其库存中.如果它在库存中,那么 Tower 将开始配置它.

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.

这篇关于无法在守护进程模式下运行 Ansible的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆