GROG.reboot
重启
一个用于重启主机的角色。
要求
- 主机应已做好Ansible使用的准备(安装Python等)
- 需要根权限,例如
become: yes
角色变量
变量 | 描述 | 默认值 |
---|---|---|
reboot_message |
日志中的重启消息 | '由Ansible重启' |
reboot_wait |
等待主机重新上线吗? | '是' |
reboot_connect_timeout |
重试之前的连接超时。 | 20 |
reboot_wait_host |
要检查的主机 | ansible_ssh_host 或 inventory_hostname |
reboot_wait_port |
要检查的端口 | ansible_ssh_port 或 22 |
reboot_wait_regex |
在套接字连接中匹配的字符串。(例如 OpenSSH ) |
/ |
reboot_wait_delay |
轮询主机之前要等待的时间(秒) | 10 |
reboot_wait_timeout |
主机成功重新启动的超时时间(秒) | 300 |
reboot_wait_ctimeout |
每次连接尝试的超时时间(秒) | 5 |
reboot_interval |
重启和下一个任务之间的间隔? | '否' |
reboot_interval_seconds |
重启后暂停的秒数 | 0 |
注意:
所有布尔值都可以使用 '是'
/'否'
或 true
/false
。
这样可以通过命令行更改它们的值(-e "bool=yes"
),不会出现问题。
依赖
无。
示例剧本
执行基本重启:
---
- hosts: servers
become: yes
roles:
- role: GROG.reboot
reboot_message: '测试重启角色'
执行滚动重启:
---
- hosts: servers
become: yes
serial: 1
roles:
- role: GROG.reboot
reboot_interval: '是'
reboot_interval_seconds: 60
贡献
欢迎所有帮助、修改或想法 欢迎!
作者
许可证
MIT