123456789101112131415161718192021222324252627 |
- ---
- - name: Install unattended-upgrades package
- apt:
- pkg: "unattended-upgrades"
- state: present
- update_cache: yes
- cache_valid_time: 1800
- - name: Enable unattended upgrades
- template:
- src: 10periodic.j2
- dest: /etc/apt/apt.conf.d/10periodic
- - name: Configure unattended upgrades
- template:
- src: 50unattended-upgrades.j2
- dest: /etc/apt/apt.conf.d/50unattended-upgrades
- - name: Let restart server once a week but not all at the same time
- cron:
- name: weekly restart
- weekday: "{{(vm_id-2)%7}}"
- hour: "3"
- minute: "{{(vm_id*2)%30+30}}"
- job: "if [ -f /var/run/reboot-required ]; then /sbin/shutdown -r +5; fi"
|