Skip to content

Commit

Permalink
Add reboot requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDoobPG committed Dec 6, 2019
1 parent 2c3dfae commit c992963
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions menu/roles/update/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,23 @@
shell: apt-get remove -y --purge $(dpkg -l | grep "^rc\s*linux-image-" | awk '{print $2}' | tr '\n' ' ')
register: apt_result
changed_when: "'packages will be REMOVED' in apt_result.stdout"

- name: updates $(hostname)
apt:
update_cache: yes
autoclean: yes
force_apt_get: yes

- name: upgrade $(hostname)
apt:
upgrade: dist
state: present
force_apt_get: yes

- name: Check if a reboot is required for $(hostname)
register: file
stat: path=/var/run/reboot-required get_md5=no

- name: Reboot the server $(hostname)
command: /sbin/reboot
when: file.stat.exists == true

0 comments on commit c992963

Please sign in to comment.