我怎样才能减慢ansible的速度?
How can I slow down ansible?
有没有办法通过在每个服务器 运行.
之间放置一个 "sleep 5 seconds" 来降低 ansible 的速度
例如,我需要这样的东西:
# --sleep-in-between is a hypothetical flag that would easily explain what I'm looking for
ansible production_servers -a "systemctl restart network" -f 1 --sleep-in-between 5secs
因此,如果 production_servers 是一组服务器:server_1
、server_2
、server_3
那么上面的命令将执行以下操作:
Output:
server_1: Executing systemctl restart network
sleep 5 seconds
server_2: Executing systemctl restart network
sleep 5 seconds
server_3: Executing systemctl restart network
sleep 5 seconds
我需要慢慢地进行自动化,以便在 ansible 运行ning 时观察系统中监控系统中发生的任何故障。
问:"有没有办法通过在每个服务器之间放置一个“睡眠 5 秒”来降低 ansible 的速度运行?” =22=]
答:是的。这是。使用wait_for module and set serial为1。例如
shell> cat playbook.yml
- hosts: all
serial: 1
tasks:
- debug:
msg: systemctl restart network
- wait_for:
timeout: "{{ sleep_in_between|default(5) }}"
默认情况下,每个主机将在终止前等待 5 秒。可以从命令行设置它。比如睡10秒
shell> ansible-playbook -e "sleep_in_between=10" playbook.yml
有没有办法通过在每个服务器 运行.
之间放置一个 "sleep 5 seconds" 来降低 ansible 的速度例如,我需要这样的东西:
# --sleep-in-between is a hypothetical flag that would easily explain what I'm looking for
ansible production_servers -a "systemctl restart network" -f 1 --sleep-in-between 5secs
因此,如果 production_servers 是一组服务器:server_1
、server_2
、server_3
那么上面的命令将执行以下操作:
Output:
server_1: Executing systemctl restart network
sleep 5 seconds
server_2: Executing systemctl restart network
sleep 5 seconds
server_3: Executing systemctl restart network
sleep 5 seconds
我需要慢慢地进行自动化,以便在 ansible 运行ning 时观察系统中监控系统中发生的任何故障。
问:"有没有办法通过在每个服务器之间放置一个“睡眠 5 秒”来降低 ansible 的速度运行?” =22=]
答:是的。这是。使用wait_for module and set serial为1。例如
shell> cat playbook.yml
- hosts: all
serial: 1
tasks:
- debug:
msg: systemctl restart network
- wait_for:
timeout: "{{ sleep_in_between|default(5) }}"
默认情况下,每个主机将在终止前等待 5 秒。可以从命令行设置它。比如睡10秒
shell> ansible-playbook -e "sleep_in_between=10" playbook.yml