使用配置文件的Ansible同步轮询
这可能并不总是可取的,或者您可能正在运行的操作比SSH超时时间更长使用配置文件的Ansible同步轮询,ansible,Ansible,这可能并不总是可取的,或者您可能正在运行的操作比SSH超时时间更长 By default tasks in playbooks block, meaning the connections stay open until the task is done on each node. 下面是一个例子 因为我的剧本中的所有任务都有单独的异步时间,所以我不想指定异步时间 但是我想为所有Playbook中的所有任务指定一次轮询时间。我们是否可以在ansible.cfg文件中为轮询设置一个配置?下面
By default tasks in playbooks block, meaning the connections stay open until the task is done on each node.
下面是一个例子
因为我的剧本中的所有任务都有单独的异步时间,所以我不想指定异步时间
但是我想为所有Playbook中的所有任务指定一次轮询时间。我们是否可以在ansible.cfg文件中为轮询设置一个配置?下面是您可以在ansible.cfg中配置的设置,以使其对所有Playbook通用。如果存在,则取消注释,否则在默认值下单独输入。请参阅示例ansible.cfg
- hosts: all
remote_user: root
tasks:
- name: simulate long running op (15 sec), wait for up to 45 sec, poll every 5 sec
command: /bin/sleep 15
async: 45
poll: 5
对于Ansible中的异步任务,请参见异步操作和
轮询,这是检查这些任务状态的频率
未提供显式轮询间隔时。默认值是
合理控制15秒,这是在签入之间的折衷
经常和提供一个快速的周转时,可能发生的事情
完成
- hosts: all
remote_user: root
tasks:
- name: simulate long running op (15 sec), wait for up to 45 sec, poll every 5 sec
command: /bin/sleep 15
async: 45
poll: 5
poll_interval = 15