forked from WSULib/state-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-upgrade.yml
31 lines (30 loc) · 950 Bytes
/
update-upgrade.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
---
# from https://www.geekandi.com/2016/03/08/using-ansible-to-update-linux-distributions/
- hosts: all
become: yes
tasks:
# This task updates servers that use 'yum' and RPM packages
# by looking for CentOS or RedHat as a distribution name. This
# will may also pick up modern OracleLinux but OL has a lot of
# different strings.
- name: .rpm upgrade server
yum: >
update_cache=yes
name=*
state=latest
update_cache=yes
when: >
ansible_distribution == 'CentOS'
or
ansible_distribution == 'RedHat'
# This task updates servers that use 'apt' and DEB packages
# by looking for Debian or Ubuntu as a distribution name.
- name: .deb do update and upgrade
apt: >
update_cache=yes
cache_valid_time=1200
upgrade=safe
when: >
ansible_distribution == 'Debian'
or
ansible_distribution == 'Ubuntu'