Added to os update playbook control reboot system
This commit is contained in:
parent
5a5644735b
commit
8b85b73396
@ -1,6 +1,6 @@
|
||||
# FAST-RABBIT collection tools and items for automation
|
||||
|
||||
<br/>
|
||||
##This repo has Ansible, Packer by HashiCorp and etc auto tools for maintenance and service IT infrastructure.<br/>
|
||||
This repo has Ansible, Packer by HashiCorp and etc auto tools for maintenance and service IT infrastructure.<br/>
|
||||
<br/>
|
||||
|
||||
|
@ -5,14 +5,28 @@
|
||||
gather_facts: true
|
||||
vars_files:
|
||||
- /root/.secret/.ansible/vars_creds.yml
|
||||
|
||||
tasks:
|
||||
- name: Upgrage system type of Debian
|
||||
- name: Upgrage system type of Debian using apt
|
||||
block:
|
||||
- name: Run "apt update" and "apt upgrade"
|
||||
ansible.builtin.apt:
|
||||
upgrade: yes
|
||||
update_cache: yes
|
||||
- name: Check system for need to reboot after update (kernel)
|
||||
stat:
|
||||
path: /var/run/reboot-required
|
||||
register: file_stat_result
|
||||
- name: Reboot system if kernel updated and requested by the system
|
||||
shell: sleep 5 && /sbin/shutdown -r now 'Rebooting system to update system /kernel as needed'
|
||||
async: 300
|
||||
poll: 0
|
||||
ignore_errors: true
|
||||
when: file_stat_result.stat.exists
|
||||
- name: Wait for system to become reachable again
|
||||
wait_for_connection:
|
||||
delay: 20
|
||||
timeout: 300
|
||||
when: file_stat_result.stat.exists
|
||||
- name: Run "apt autoremove"
|
||||
ansible.builtin.apt:
|
||||
autoremove: yes
|
||||
|
Loading…
x
Reference in New Issue
Block a user