This commit is contained in:
18
tasks/main.yml
Normal file
18
tasks/main.yml
Normal file
@ -0,0 +1,18 @@
|
||||
- name: Load OS Specific Vars
|
||||
include_vars: "{{ lookup('first_found', possible_files) }}"
|
||||
vars:
|
||||
possible_files:
|
||||
- "../vars/{{ ansible_distribution }}.yml"
|
||||
tags: [ 'install', 'prepare' ]
|
||||
|
||||
- include_tasks: update-RedHat.yml
|
||||
when:
|
||||
- ansible_os_family == 'RedHat'
|
||||
|
||||
- include_tasks: update-Debian.yml
|
||||
when:
|
||||
- ansible_os_family == 'Debian'
|
||||
|
||||
- include_tasks: update-Arch.yml
|
||||
when:
|
||||
- ansible_os_family == 'Archlinux'
|
19
tasks/update-Arch.yml
Normal file
19
tasks/update-Arch.yml
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
- name: Update
|
||||
become: yes
|
||||
become_method: sudo
|
||||
pacman:
|
||||
update_cache: yes
|
||||
upgrade: yes
|
||||
when: ansible_os_family == "Archlinux"
|
||||
|
||||
- name: Check if a reboot is required
|
||||
register: reboot_required_file
|
||||
stat:
|
||||
path: /var/run/reboot-required get_md5=no
|
||||
|
||||
- name: Needs Reboot
|
||||
debug:
|
||||
msg: "Restart Required!!"
|
||||
ignore_errors: true
|
||||
when: reboot_required_file.stat.exists == true
|
46
tasks/update-Debian.yml
Normal file
46
tasks/update-Debian.yml
Normal file
@ -0,0 +1,46 @@
|
||||
---
|
||||
|
||||
- name: Update apt keys
|
||||
become: yes
|
||||
command: apt-key update
|
||||
when: ansible_os_family == "Debian" or ansible_os_family == "OSMC"
|
||||
|
||||
- name: Upgrade all packages to the latest version
|
||||
become: yes
|
||||
apt:
|
||||
upgrade: dist
|
||||
update_cache: yes
|
||||
cache_valid_time: 3600
|
||||
environment:
|
||||
PATH: "{{ ansible_env.PATH }}:/sbin:/usr/sbin"
|
||||
when: ansible_os_family == "Debian" or ansible_os_family == "OSMC"
|
||||
|
||||
- name: Remove useless packages from the cache
|
||||
become: yes
|
||||
become_method: sudo
|
||||
ignore_errors: true
|
||||
command: >
|
||||
apt-get autoremove -y
|
||||
environment:
|
||||
PATH: "{{ ansible_env.PATH }}:/sbin:/usr/sbin"
|
||||
when: ansible_os_family == "Debian" or ansible_os_family == "OSMC"
|
||||
|
||||
- name: install packages
|
||||
become: yes
|
||||
apt:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
with_items:
|
||||
- "{{ package_list }}"
|
||||
when: install and ansible_os_family == "Debian"
|
||||
|
||||
- name: Check if a reboot is required
|
||||
register: reboot_required_file
|
||||
stat:
|
||||
path: /var/run/reboot-required get_md5=no
|
||||
|
||||
- name: Needs Reboot
|
||||
debug:
|
||||
msg: "Restart Required!!"
|
||||
ignore_errors: true
|
||||
when: reboot_required_file.stat.exists == true
|
9
tasks/update-RedHat.yml
Normal file
9
tasks/update-RedHat.yml
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
|
||||
- name: install updates
|
||||
become: yes
|
||||
yum:
|
||||
update_cache: yes
|
||||
name: '*'
|
||||
state: latest
|
||||
when: ansible_os_family == "RedHat"
|
Reference in New Issue
Block a user