mirror of
https://github.com/luzifer-ansible/ubuntu-unattended-upgrades.git
synced 2024-11-08 13:40:02 +00:00
Initial version
This commit is contained in:
commit
5318e4addc
3 changed files with 48 additions and 0 deletions
5
defaults/main.yml
Normal file
5
defaults/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
mail_target: "mail@example.com"
|
||||
reboot_time: "04:00"
|
||||
do_reboot: "true"
|
||||
do_autoremove: "false"
|
2
files/20auto-upgrades
Normal file
2
files/20auto-upgrades
Normal file
|
@ -0,0 +1,2 @@
|
|||
APT::Periodic::Update-Package-Lists "1";
|
||||
APT::Periodic::Unattended-Upgrade "1";
|
41
tasks/main.yml
Normal file
41
tasks/main.yml
Normal file
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
|
||||
- name: Install required packages for autoupdate
|
||||
apt: name={{ item }} update_cache=yes
|
||||
with_items:
|
||||
- unattended-upgrades
|
||||
- update-notifier-common
|
||||
- sendmail
|
||||
|
||||
- name: Add configuration file
|
||||
copy: dest=/etc/apt/apt.conf.d/20auto-upgrades src=20auto-upgrades
|
||||
|
||||
- name: Configure mail target for Unattended Upgrade
|
||||
lineinfile: line="Unattended-Upgrade::Mail \"{{mail_target}}\";"
|
||||
args:
|
||||
dest: /etc/apt/apt.conf.d/50unattended-upgrades
|
||||
regexp: '^(//)?Unattended-Upgrade::Mail '
|
||||
|
||||
- name: Set auto-reboot-time for Unattended Upgrade
|
||||
lineinfile: line="Unattended-Upgrade::Automatic-Reboot-Time \"{{reboot_time}}\";"
|
||||
args:
|
||||
dest: /etc/apt/apt.conf.d/50unattended-upgrades
|
||||
regexp: '^(//)?Unattended-Upgrade::Automatic-Reboot-Time '
|
||||
|
||||
- name: Set auto-reboot for Unattended Upgrade
|
||||
lineinfile: line="Unattended-Upgrade::Automatic-Reboot \"{{do_reboot}}\";"
|
||||
args:
|
||||
dest: /etc/apt/apt.conf.d/50unattended-upgrades
|
||||
regexp: '^(//)?Unattended-Upgrade::Automatic-Reboot '
|
||||
|
||||
- name: Set autoremove for Unattended Upgrade
|
||||
lineinfile: line="Unattended-Upgrade::Remove-Unused-Dependencies \"{{do_autoremove}}\";"
|
||||
args:
|
||||
dest: /etc/apt/apt.conf.d/50unattended-upgrades
|
||||
regexp: '^(//)?Unattended-Upgrade::Remove-Unused-Dependencies '
|
||||
|
||||
- name: Enable normal updates
|
||||
lineinfile: line=' "${distro_id}:${distro_codename}-updates";'
|
||||
args:
|
||||
dest: /etc/apt/apt.conf.d/50unattended-upgrades
|
||||
regexp: '\$\{distro_id\}:\$\{distro_codename\}-updates'
|
Loading…
Reference in a new issue