Add system upgrade role
initial commit
This commit is contained in:
commit
1fe4c617db
7 changed files with 137 additions and 0 deletions
38
roles/system-upgrade/tasks/Ubuntu.yml
Normal file
38
roles/system-upgrade/tasks/Ubuntu.yml
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
- name: Ensure aptitude installed
|
||||
apt:
|
||||
name: "aptitude"
|
||||
state: present
|
||||
tags:
|
||||
- apt
|
||||
- download
|
||||
- packages
|
||||
become: true
|
||||
|
||||
- name: Ensure OS upgraded
|
||||
apt:
|
||||
upgrade: dist
|
||||
tags:
|
||||
- apt
|
||||
- update
|
||||
- os
|
||||
become: true
|
||||
|
||||
- name: Check if reboot is necessary
|
||||
register: reboot_required_file
|
||||
stat:
|
||||
path: /var/run/reboot-required
|
||||
get_md5: no
|
||||
tags:
|
||||
- os
|
||||
- reboot
|
||||
notify: reboot host
|
||||
|
||||
- name: Ensure all packages updated
|
||||
apt:
|
||||
name: "*"
|
||||
state: latest # noqa 403
|
||||
tags:
|
||||
- apt
|
||||
- update
|
||||
- packages
|
||||
become: true
|
||||
11
roles/system-upgrade/tasks/main.yml
Normal file
11
roles/system-upgrade/tasks/main.yml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
# Bring the bare-metal system to the newest updated status
|
||||
|
||||
- name: "Select tasks for {{ ansible_distribution }} {{ ansible_distribution_major_version }}"
|
||||
include_tasks: "{{ distribution }}"
|
||||
with_first_found:
|
||||
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
|
||||
- "{{ ansible_distribution }}.yml"
|
||||
- "{{ ansible_os_family }}.yml"
|
||||
loop_control:
|
||||
loop_var: distribution
|
||||
Loading…
Add table
Add a link
Reference in a new issue