update-system/tasks/update-Debian.yml
Tobias Trabelsi 1b3337d422
All checks were successful
continuous-integration/drone/push Build is passing
simplified install package logic
2021-06-28 21:24:51 +02:00

44 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: "{{ package_list | list }}"
state: present
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