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
|
# FAST-RABBIT collection tools and items for automation
|
||||||
|
|
||||||
<br/>
|
<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/>
|
<br/>
|
||||||
|
|
||||||
|
@ -5,14 +5,28 @@
|
|||||||
gather_facts: true
|
gather_facts: true
|
||||||
vars_files:
|
vars_files:
|
||||||
- /root/.secret/.ansible/vars_creds.yml
|
- /root/.secret/.ansible/vars_creds.yml
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Upgrage system type of Debian
|
- name: Upgrage system type of Debian using apt
|
||||||
block:
|
block:
|
||||||
- name: Run "apt update" and "apt upgrade"
|
- name: Run "apt update" and "apt upgrade"
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
upgrade: yes
|
upgrade: yes
|
||||||
update_cache: 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"
|
- name: Run "apt autoremove"
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
autoremove: yes
|
autoremove: yes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user