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

查看:69
本文介绍了无法在守护程序模式下运行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脚本来完成此工作,请参见此处的文档:

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是一个脚本,可以从远程存储库中获取您的配置剧本,并在localhost上运行它们.但是,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天全站免登陆