Enabling and configuring unattended-upgrades.

This commit is contained in:
Emiliano Vavassori 2015-10-05 21:13:09 +02:00
parent 328f106497
commit c75ddcf1a3
5 changed files with 75 additions and 9 deletions

View File

@ -0,0 +1,5 @@
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "7";
APT::Periodic::Unattended-Upgrade "1";
//APT::Periodic::RandomSleep "0";

View File

@ -0,0 +1,33 @@
// Automatically upgrade packages from these (origin, archive) pairs
Unattended-Upgrade::Allowed-Origins {
"${distro_id}:${distro_codename}";
"${distro_id}:${distro_codename}-security";
"${distro_id}:${distro_codename}-updates";
"${distro_id}:${distro_codename}-proposed";
"${distro_id}:${distro_codename}-backports";
"LP-PPA-libreoffice-libreoffice-5-0:trusty";
"LP-PPA-ansible-ansible:trusty";
"BgLUG:trusty";
};
// List of packages to not update
Unattended-Upgrade::Package-Blacklist {
// "vim";
// "libc6";
// "libc6-dev";
// "libc6-i686";
};
// Send email to this address for problems or packages upgrades
// If empty or unset then no email is sent, make sure that you
// have a working mail setup on your system. The package 'mailx'
// must be installed or anything that provides /usr/bin/mail.
//Unattended-Upgrade::Mail "root@localhost";
// Do automatic removal of new unused dependencies after the upgrade
// (equivalent to apt-get autoremove)
Unattended-Upgrade::Remove-Unused-Dependencies "true";
// Automatically reboot *WITHOUT CONFIRMATION* if a
// the file /var/run/reboot-required is found after the upgrade
Unattended-Upgrade::Automatic-Reboot "false";

View File

@ -1,20 +1,11 @@
---
- name: Adding sys42 repo
lineinfile:
dest: /etc/apt/sources.list.d/sys42.list
line: 'deb http://bglug.sys42.eu/ubuntu trusty main'
create: yes
state: present
when: ansible_product_name == 'VirtualBox'
- name: Adding mirrored sys42 repo
lineinfile:
dest: /etc/apt/sources.list.d/sys42.list
line: 'deb http://{{ ansible_local.domain.mirrorpath }}bglug.sys42.eu/ubuntu trusty main'
create: yes
state: present
when: ansible_product_name != 'VirtualBox'
- name: Reloading available packages
apt:

View File

@ -1,6 +1,11 @@
---
# BgLUG customization
- include: unattended-upgrades.yml
tags:
- custom
- unattended-upgrades
- include: custom.yml
tags:
- custom

View File

@ -0,0 +1,32 @@
---
- name: Adding proposed sources to apt/sources.list
lineinfile:
line: "{{ item }}"
dest: /etc/apt/sources.list
with_items:
- "deb http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-proposed restricted main multiverse universe"
- "deb-src http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-proposed restricted main multiverse universe"
sudo: yes
- name: Ensure unattended-upgrades is installed
apt:
name: unattended-upgrades
state: present
sudo: yes
- name: Ensure update-notifier-common is installed
apt:
name: update-notifier-common
state: present
sudo: yes
- name: Configuring unattended upgrades from file
copy:
src: 50-unattended-upgrades
dest: /etc/apt/apt.conf.d/50-unattended-upgrades
- name: Activating automatic updates
copy:
src: 20-auto-upgrades
dest: /etc/apt/apt.conf.d/20-auto-upgrades