46 lines
1.1 KiB
YAML
46 lines
1.1 KiB
YAML
|
---
|
||
|
|
||
|
- 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
|