added reboot functionality to update role
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
---
|
||||
update_autoremove: yes
|
||||
update_autoremove: yes
|
||||
update_reboot_allowed: yes
|
||||
@@ -8,6 +8,25 @@
|
||||
- name: "Autoremove and cleanup"
|
||||
apt:
|
||||
autoremove: yes
|
||||
clean: yes
|
||||
autoclean: yes
|
||||
when:
|
||||
- "update_autoremove"
|
||||
- "update_autoremove"
|
||||
|
||||
- name: "Check if reboot file exists"
|
||||
stat:
|
||||
path: "/var/run/reboot-required"
|
||||
register: p
|
||||
|
||||
- name: "Output required reboot"
|
||||
debug:
|
||||
msg:
|
||||
- "Reboot required: {{ p.stat.exists }}"
|
||||
- "Reboot allowed: {{ update_reboot_allowed }}"
|
||||
|
||||
- name: "Reboot Host"
|
||||
reboot:
|
||||
msg: "Reboot initiated by Ansible"
|
||||
post_reboot_delay: 10
|
||||
when:
|
||||
- "p.stat.exists"
|
||||
- "update_reboot_allowed"
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
- hosts: all
|
||||
remote_user: root
|
||||
roles:
|
||||
- Ansible-Role-Update
|
||||
Reference in New Issue
Block a user