removed duplicate playbooks
This commit is contained in:
parent
e7da3cad2a
commit
d953a2fa6b
27
reboot.yml
27
reboot.yml
@ -1,27 +0,0 @@
|
||||
---
|
||||
- name: Reboot host
|
||||
hosts: all
|
||||
remote_user: root
|
||||
tasks:
|
||||
- name: reboot host
|
||||
shell: 'sleep 5 && shutdown -r now "Reboot by Ansible."'
|
||||
register: reboot
|
||||
async: 1
|
||||
poll: 0
|
||||
ignore_errors: true
|
||||
|
||||
- name: wait for server to come down
|
||||
local_action: wait_for host={{ inventory_hostname }} port=22 state=stopped
|
||||
|
||||
- name: wait for server to come up
|
||||
local_action: wait_for host={{ inventory_hostname }} port=22 state=started
|
||||
|
||||
- name: check uptime
|
||||
shell: 'uptime'
|
||||
register: uptime
|
||||
|
||||
- name: show uptime
|
||||
debug:
|
||||
msg: "Uptime: {{ uptime.stdout }}"
|
||||
...
|
||||
|
@ -1,39 +0,0 @@
|
||||
---
|
||||
- name: Reboot host
|
||||
hosts: all
|
||||
remote_user: root
|
||||
tasks:
|
||||
- name: check if reboot is required
|
||||
stat:
|
||||
path: /lib/modules/{{ ansible_kernel }}
|
||||
register: modules
|
||||
|
||||
- name: reboot host
|
||||
shell: 'sleep 5 && shutdown -r now "Reboot by Ansible."'
|
||||
register: reboot
|
||||
async: 1
|
||||
poll: 0
|
||||
ignore_errors: true
|
||||
when: modules.stat.isdir is not defined
|
||||
|
||||
- name: wait for server to come down
|
||||
local_action: wait_for host={{ inventory_hostname }} port=22 state=stopped
|
||||
when:
|
||||
- reboot.stdout is defined
|
||||
- "'Reboot by Ansible.' in reboot.stdout"
|
||||
|
||||
- name: wait for server to come up
|
||||
local_action: wait_for host={{ inventory_hostname }} port=22 state=started
|
||||
when:
|
||||
- reboot.stdout is defined
|
||||
- "'Reboot by Ansible.' in reboot.stdout"
|
||||
|
||||
- name: check uptime
|
||||
shell: 'uptime'
|
||||
register: uptime
|
||||
|
||||
- name: show uptime
|
||||
debug:
|
||||
msg: "Uptime: {{ uptime.stdout }}"
|
||||
...
|
||||
|
Loading…
Reference in New Issue
Block a user