是否可以在“拉模式"下运行剧本? [英] Is it possible to run a playbook in "pull mode"?

查看:67
本文介绍了是否可以在“拉模式"下运行剧本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些剧本,它们是在主控主机上启动的,并在远程主机上运行特定的操作.这是一种推送"模式-活动由主控主机启动.

I have playbooks which I start on a master host and which run specific actions on remote hosts. This is a "push" mode - the activity is initiated by the master host.

我的几个主机在给定时间关闭,并且显然在这种状态下无法运行该剧本.这样会导致主机是最新的,而其他主机则不是.

Several of my hosts are down at a given time and obviously fail to run the playbook when in such a state. This leads to hosts which are up-to-date, while others are not.

要解决此问题,我可以定期在主机上运行剧本(例如,通过cron),但这并不是特别有效.

To fix this I could run the playbook on the master host in a regular way (via cron for instance) but this is not particularly effective.

Ansible中是否有内置的方法来逆向流程,即从远程主机启动主机上可用的剧本,然后在该远程主机上运行它?

Is there a built-in way in Ansible to reverse the flow, that is to initiate from a remote host a playbook available on the master, to run it on that remote host?

我可以想象远程主机可以SSH到主机(例如在启动时),然后以主机为参数(或类似想法)触发剧本,但我绝对希望使用Ansible功能而不是重新发明它.

I can imagine that the remote host could ssh to the master (at boot time for instance) and then trigger the playbook with the host as a parameter (or something around that idea) but I would definitely prefer to use an Ansible feature instead of reinventing it.

推荐答案

有一个名为 ansible-pull 可以逆转Ansible的默认推送架构. Ansible开发人员还提供了示例剧本

There is a script called ansible-pull which reverses the default push architecture of Ansible. There is also an example playbook from the Ansible developers available.

这篇关于是否可以在“拉模式"下运行剧本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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