ansible/utils/reboot.yml

37 lines
774 B
YAML
Raw Permalink Normal View History

2020-04-10 19:38:37 +00:00
---
- name: reboot nodes
2020-05-25 22:41:41 +00:00
hosts: docker_cluster
2020-04-10 19:38:37 +00:00
become_method: sudo
become_user: root
become: yes
serial: 1
tasks:
- name: drain docker swarm
shell:
cmd: |
2020-05-25 22:41:41 +00:00
docker node update {{ ansible_hostname }} --availability drain
2020-04-10 19:38:37 +00:00
sleep 30
- name: reboot
reboot:
msg: "Rebooting"
connect_timeout: 5
reboot_timeout: 600
pre_reboot_delay: 0
post_reboot_delay: 30
test_command: whoami
- name: update datetime via ntpdate
shell:
cmd: |
ntpdate 192.168.50.3
args:
executable: /bin/bash
- name: drain docker swarm
shell:
cmd: |
2020-05-25 22:41:41 +00:00
docker node update {{ ansible_hostname }} --availability active
2020-04-10 19:38:37 +00:00
sleep 30