update-system/tasks/update-Debian.yml

44 lines
1.1 KiB
YAML
Raw Normal View History

2021-01-30 18:50:13 +00:00
---
- 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:
2021-06-28 19:24:51 +00:00
name: "{{ package_list | list }}"
2021-01-30 18:50:13 +00:00
state: present
when: install and ansible_os_family == "Debian"
2021-06-26 11:58:43 +00:00
- 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