From 28eb8ce2aaf898ae7c4b139758def72267a5733a Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Mon, 5 Oct 2015 21:46:36 +0200 Subject: [PATCH] Restructuring custom role, to correctly compose apt/sources.list{,.d}. --- roles/custom/files/50-unattended-upgrades | 1 + roles/custom/tasks/custom.yml | 11 --------- roles/custom/tasks/main.yml | 5 ++++ roles/custom/tasks/repos.yml | 27 ++++++++++++++++++++++ roles/custom/tasks/unattended-upgrades.yml | 26 ++++++--------------- roles/custom/templates/ansible.list | 2 ++ roles/custom/templates/libreoffice.list | 2 ++ roles/custom/templates/sources.list | 19 +++++++++++++++ roles/custom/templates/sys42.list | 2 ++ 9 files changed, 65 insertions(+), 30 deletions(-) create mode 100644 roles/custom/tasks/repos.yml create mode 100644 roles/custom/templates/ansible.list create mode 100644 roles/custom/templates/libreoffice.list create mode 100644 roles/custom/templates/sources.list create mode 100644 roles/custom/templates/sys42.list diff --git a/roles/custom/files/50-unattended-upgrades b/roles/custom/files/50-unattended-upgrades index 970bf45..9ff133c 100644 --- a/roles/custom/files/50-unattended-upgrades +++ b/roles/custom/files/50-unattended-upgrades @@ -5,6 +5,7 @@ Unattended-Upgrade::Allowed-Origins { "${distro_id}:${distro_codename}-updates"; "${distro_id}:${distro_codename}-proposed"; "${distro_id}:${distro_codename}-backports"; + "LP-PPA-app-review-board:trusty"; "LP-PPA-libreoffice-libreoffice-5-0:trusty"; "LP-PPA-ansible-ansible:trusty"; "BgLUG:trusty"; diff --git a/roles/custom/tasks/custom.yml b/roles/custom/tasks/custom.yml index d843a08..a22bc6f 100644 --- a/roles/custom/tasks/custom.yml +++ b/roles/custom/tasks/custom.yml @@ -1,16 +1,5 @@ --- -- 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 - -- name: Reloading available packages - apt: - update_cache: yes - - name: Installing plymouth theme apt: name: plymouth-theme-edubuntu-bglug diff --git a/roles/custom/tasks/main.yml b/roles/custom/tasks/main.yml index 00bcd84..3f412ec 100644 --- a/roles/custom/tasks/main.yml +++ b/roles/custom/tasks/main.yml @@ -1,6 +1,11 @@ --- # BgLUG customization +- include: repos.yml + tags: + - custom + - repos + - include: unattended-upgrades.yml tags: - custom diff --git a/roles/custom/tasks/repos.yml b/roles/custom/tasks/repos.yml new file mode 100644 index 0000000..99d262d --- /dev/null +++ b/roles/custom/tasks/repos.yml @@ -0,0 +1,27 @@ +--- +# Fixing all the stuff around repositories. + +# Provide a clean and ordered sources.list +- name: Replace sources.list with a clean one. + template: + src: sources.list + dest: /etc/apt/sources.list + +- name: Adding Ansible repo + template: + src: ansible.list + dest: /etc/apt/sources.list.d/ansible.list + +- name: Adding LibreOffice repo + template: + src: libreoffice.list + dest: /etc/apt/sources.list.d/libreoffice.list + +- name: Adding BgLUG repo + template: + src: sys42.list + dest: /etc/apt/sources.list.d/sys42.list + +- name: Regenerating package cache + apt: update_cache=yes + sudo: yes diff --git a/roles/custom/tasks/unattended-upgrades.yml b/roles/custom/tasks/unattended-upgrades.yml index 34ebea6..018cf24 100644 --- a/roles/custom/tasks/unattended-upgrades.yml +++ b/roles/custom/tasks/unattended-upgrades.yml @@ -1,25 +1,13 @@ --- -- name: Adding proposed sources to apt/sources.list - lineinfile: - line: "{{ item }}" - dest: /etc/apt/sources.list +- name: Ensure needed packages are installed + apt: + name: "{{ item }}" + state: present + sudo: yes 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 + - unattended-upgrades + - update-notifier-common - name: Configuring unattended upgrades from file copy: diff --git a/roles/custom/templates/ansible.list b/roles/custom/templates/ansible.list new file mode 100644 index 0000000..53002a8 --- /dev/null +++ b/roles/custom/templates/ansible.list @@ -0,0 +1,2 @@ +## Ansible Official PPA +deb http://{{ ansible_local.domain.mirrorpath }}ppa.launchpad.net/ansible/ansible/ubuntu trusty main diff --git a/roles/custom/templates/libreoffice.list b/roles/custom/templates/libreoffice.list new file mode 100644 index 0000000..13b7e57 --- /dev/null +++ b/roles/custom/templates/libreoffice.list @@ -0,0 +1,2 @@ +## LibreOffice Official PPA +deb http://{{ ansible_local.domain.mirrorpath }}ppa.launchpad.net/libreoffice/libreoffice-5-0/ubuntu trusty main diff --git a/roles/custom/templates/sources.list b/roles/custom/templates/sources.list new file mode 100644 index 0000000..63160be --- /dev/null +++ b/roles/custom/templates/sources.list @@ -0,0 +1,19 @@ +# Base +deb http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu trusty main restricted universe multiverse +deb-src http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu trusty main restricted universe multiverse + +# updates +deb http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse +deb-src http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse + +# backports +deb http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse +deb-src http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse + +# security +deb http://{{ ansible_local.domain.mirrorpath }}security.ubuntu.com/ubuntu trusty-security main restricted universe multiverse +deb-src http://{{ ansible_local.domain.mirrorpath }}security.ubuntu.com/ubuntu trusty-security main restricted universe multiverse + +# extras +deb http://{{ ansible_local.domain.mirrorpath }}extras.ubuntu.com/ubuntu trusty main +deb-src http://{{ ansible_local.domain.mirrorpath }}extras.ubuntu.com/ubuntu trusty main diff --git a/roles/custom/templates/sys42.list b/roles/custom/templates/sys42.list new file mode 100644 index 0000000..ae5fca1 --- /dev/null +++ b/roles/custom/templates/sys42.list @@ -0,0 +1,2 @@ +# BgLUG repo @ sys42 +deb http://{{ ansible_local.domain.mirrorpath }}bglug.sys42.eu/ubuntu trusty main