- name: Install automatic upgrade package package: name: unattended-upgrades - name: Configure automatic upgrades lineinfile: path: /etc/apt/apt.conf.d/20auto-upgrades create: yes line: '{{ item }}' loop: - 'APT::Periodic::Update-Package-Lists "1";' - 'APT::Periodic::Unattended-Upgrade "1";'