-
Notifications
You must be signed in to change notification settings - Fork 0
/
reboot.yml
42 lines (28 loc) · 820 Bytes
/
reboot.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
- hosts: localhost
gather_facts: no
user: ansible
vars_prompt:
- name: target
prompt: Which host or hosts do you need to reboot (comma-separated hostname list)?
default: "null"
private: false
tasks:
- add_host:
name: "{{ item }}"
groups: dynamically_created_hosts
with_items: "{{ target.split(',') }}"
- hosts: dynamically_created_hosts
remote_user: ansible
become: yes
vars_prompt:
- name: delay
prompt: 'How long, in seconds, to delay before rebooting (default: 15)?'
default: "15"
private: false
tasks:
- name: "Reboot the target node or group"
ansible.builtin.reboot:
post_reboot_delay: 15
reboot_timeout: 300
pre_reboot_delay: "{{ delay|int }}"