mirror of
https://github.com/JamesTurland/JimsGarage.git
synced 2024-11-21 23:40:19 +00:00
update
This commit is contained in:
parent
a93d38816c
commit
57cdb3e71d
2 changed files with 30 additions and 0 deletions
7
Ansible/Playbooks/Update/readme.md
Normal file
7
Ansible/Playbooks/Update/readme.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# Add to Hosts File (change ansible_user if required)
|
||||||
|
```
|
||||||
|
[all:vars]
|
||||||
|
ansible_user='ubuntu'
|
||||||
|
ansible_become=yes
|
||||||
|
ansible_become_method=sudo
|
||||||
|
```
|
23
Ansible/Playbooks/Update/update.yml
Normal file
23
Ansible/Playbooks/Update/update.yml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
become: true
|
||||||
|
tasks:
|
||||||
|
- name: Update apt repo and cache on all Debian/Ubuntu boxes
|
||||||
|
apt: update_cache=yes force_apt_get=yes cache_valid_time=3600
|
||||||
|
|
||||||
|
- name: Upgrade all packages on servers
|
||||||
|
apt: upgrade=dist force_apt_get=yes
|
||||||
|
|
||||||
|
- name: Check if a reboot is needed on all servers
|
||||||
|
register: reboot_required_file
|
||||||
|
stat: path=/var/run/reboot-required get_md5=no
|
||||||
|
|
||||||
|
- name: Reboot the box if kernel updated
|
||||||
|
reboot:
|
||||||
|
msg: "Reboot initiated by Ansible for kernel updates"
|
||||||
|
connect_timeout: 5
|
||||||
|
reboot_timeout: 300
|
||||||
|
pre_reboot_delay: 0
|
||||||
|
post_reboot_delay: 30
|
||||||
|
test_command: uptime
|
||||||
|
when: reboot_required_file.stat.exists
|
Loading…
Reference in a new issue