initial commit
This commit is contained in:
32
tasks/main.yml
Normal file
32
tasks/main.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
|
||||
- name: "Install/Remove package unattended-upgrades"
|
||||
apt:
|
||||
update_cache: true
|
||||
name: "unattended-upgrades"
|
||||
state: "{{ autoupdate_enabled | ternary('present', 'absent') }}"
|
||||
|
||||
- name: "Deploy configs"
|
||||
ansible.builtin.template:
|
||||
src: "templates/{{ item.template }}"
|
||||
loop:
|
||||
- template: "auto-upgrades.j2"
|
||||
dest: "/etc/apt/apt.conf.d/20auto-upgrades"
|
||||
- template: "unattended-upgrades.j2"
|
||||
dest: "/etc/apt/apt.conf.d/50unattended-upgrades"
|
||||
when: "autoupdate_enabled"
|
||||
|
||||
- name: "Restart service"
|
||||
ansible.builtin.systemd_service:
|
||||
name: "unattended-upgrades"
|
||||
state: "restarted"
|
||||
when: "autoupdate_enabled"
|
||||
|
||||
- name: "Remove configs"
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: "absent"
|
||||
loop:
|
||||
- "/etc/apt/apt.conf.d/20auto-upgrades"
|
||||
- "/etc/apt/apt.conf.d/50unattended-upgrades"
|
||||
when: "not autoupdate_enabled"
|
||||
Reference in New Issue
Block a user