diff --git a/tasks/main.yml b/tasks/main.yml index 63216d6..9a924fa 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,24 +1,2 @@ ---- -- name: add distribution-specific variables - include_vars: "{{ ansible_distribution }}.yml" - -- name: install unattended-upgrades - apt: pkg=unattended-upgrades state=present - tags: unattended - -- name: install reboot dependencies - include: reboot.yml - when: unattended_automatic_reboot - tags: unattended - -- name: create APT auto-upgrades configuration - copy: > - src=auto-upgrades dest=/etc/apt/apt.conf.d/20auto-upgrades - owner=root group=root mode=0644 - tags: unattended - -- name: create unattended-upgrades configuration - template: > - src=unattended-upgrades.j2 dest=/etc/apt/apt.conf.d/50unattended-upgrades - owner=root group=root mode=0644 - tags: unattended + - include: unattended-upgrades.yml + tags: unattended diff --git a/tasks/reboot.yml b/tasks/reboot.yml index 014cd78..783f2d8 100644 --- a/tasks/reboot.yml +++ b/tasks/reboot.yml @@ -3,10 +3,8 @@ apt: pkg=update-notifier-common state=present register: install_reboot_dependency ignore_errors: true - tags: unattended - name: abort if automatic reboot is unavailable fail: msg="The unattended_automatic_reboot option was selected but the system has no means to reboot automatically" when: install_reboot_dependency | failed - tags: unattended diff --git a/tasks/unattended-upgrades.yml b/tasks/unattended-upgrades.yml new file mode 100644 index 0000000..5b35476 --- /dev/null +++ b/tasks/unattended-upgrades.yml @@ -0,0 +1,20 @@ +--- +- name: add distribution-specific variables + include_vars: "{{ ansible_distribution }}.yml" + +- name: install unattended-upgrades + apt: pkg=unattended-upgrades state=present + +- name: install reboot dependencies + include: reboot.yml + when: unattended_automatic_reboot + +- name: create APT auto-upgrades configuration + copy: > + src=auto-upgrades dest=/etc/apt/apt.conf.d/20auto-upgrades + owner=root group=root mode=0644 + +- name: create unattended-upgrades configuration + template: > + src=unattended-upgrades.j2 dest=/etc/apt/apt.conf.d/50unattended-upgrades + owner=root group=root mode=0644