--- # # Installs upgrades and configures package manager. # - name: Upgrade packages apt: update_cache: yes upgrade: dist register: result - name: Update GRUB command: update-grub environment: UCF_FORCE_CONFFNEW: YES when: result is changed - name: Install Debian utilities apt: name: "{{ item }}" state: present with_items: - debconf-utils - unattended-upgrades - name: Enable unattended upgrades debconf: name: unattended-upgrades question: unattended-upgrades/enable_auto_updates vtype: boolean value: "true" register: result - name: Reconfigure unattended upgrades command: dpkg-reconfigure -f noninteractive unattended-upgrades when: result is changed