homeserver/roles/hifis-net.unattended_upgrades/tasks/unattended-upgrades.yml

39 lines
1.2 KiB
YAML
Raw Normal View History

---
- name: "Add distribution-specific variables"
ansible.builtin.include_vars: "{{ ansible_distribution }}.yml"
- name: "Add Debian Bullseye workaround"
ansible.builtin.include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_release }}.yml"
when:
- "ansible_distribution == 'Debian'"
- "ansible_distribution_release == 'bullseye'"
- name: "Install powermgmt-base"
ansible.builtin.apt:
name: "powermgmt-base"
state: "present"
cache_valid_time: "{{ unattended_cache_valid_time }}"
update_cache: "yes"
force_apt_get: "yes"
when: "unattended_only_on_ac_power"
- name: "Install unattended-upgrades"
ansible.builtin.apt:
name: "unattended-upgrades"
state: "present"
cache_valid_time: "{{ unattended_cache_valid_time }}"
update_cache: "yes"
force_apt_get: "yes"
- name: "Install reboot dependencies"
ansible.builtin.import_tasks: "reboot.yml"
when: "unattended_automatic_reboot | bool"
- name: "Create Apt auto-upgrades & unattended-upgrades configuration"
ansible.builtin.template:
src: "unattended-upgrades.j2"
dest: "/etc/apt/apt.conf.d/90-ansible-unattended-upgrades"
owner: "root"
group: "root"
mode: "0644"