---
- name: Install unattended-upgrades
  apt:
    name: unattended-upgrades
    state: latest

- name: Configure unattended-upgrades
  template:
    src: 50unattended-upgrades.j2
    dest: /etc/apt/apt.conf.d/50unattended-upgrades
    owner: root
    group: root
    mode: 0644

- name: Periodic upgrades configured
  template:
    src: 10periodic.j2
    dest: /etc/apt/apt.conf.d/10periodic
    owner: root
    group: root
    mode: 0644

- name: Unattended reboots configured
  template:
    src: 60unattended-reboot.j2
    dest: /etc/apt/apt.conf.d/60unattended-reboot
    owner: root
    group: root
    mode: 0644
