From 0f34555f8b3390d77a0ae0f8a5b03045e951b392 Mon Sep 17 00:00:00 2001 From: L3D Date: Fri, 28 Aug 2020 10:41:48 +0200 Subject: [PATCH] Cleanup package addition --- defaults/main.yml | 6 ++++++ tasks/main.yml | 1 + tasks/sources.yml | 52 ++++++++++------------------------------------- 3 files changed, 18 insertions(+), 41 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 2332061..12b15ba 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -4,8 +4,14 @@ base__extra_packages: [] # - foo # - bar +# should we add additional package source? base__add_ethz: "{{ add_ethz }}" +# add nonfree/firmware packages? +base__pkg_non_free_firmware: "{{ base_pkg_non_free_firmware }}" +base__pkg_contrib: "{{ base_pkg_contrib }}" +# optionaly print some OS vars +base__print_os_vars: "{{ print_os_vars }}" diff --git a/tasks/main.yml b/tasks/main.yml index a33ef8f..3076136 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -9,6 +9,7 @@ when: - ansible_os_family == 'Debian' - base__add_ethz | bool + - ansible_architecture == 'x86_64' - name: Install common base packages [Debian] become: yes diff --git a/tasks/sources.yml b/tasks/sources.yml index cc1dc31..ca07657 100644 --- a/tasks/sources.yml +++ b/tasks/sources.yml @@ -1,6 +1,6 @@ --- -- name: Install some common Debian specific packages - become: yes +- name: Install requirements to add packages + become: true apt: package: - debian-goodies @@ -12,62 +12,32 @@ when: - ansible_machine != 'armv6l' and ansible_distribution_release != 'wheezy' -- name: add eth zurich apt +- name: add eth zurich apt (main) become: true apt_repository: repo: deb https://debian.ethz.ch/debian/ {{ ansible_distribution_release }} main state: present when: - - not base_pkg_non_free_firmware | bool - - not base_pkg_contrib | bool - - add_ethz | bool - - ansible_distribution == 'Debian' + - not base__pkg_non_free_firmware | bool + - not base__pkg_contrib | bool - ansible_machine != 'armv6l' and ansible_distribution_release != 'wheezy' -- name: add eth zurich apt +- name: add eth zurich apt (main non-free) become: true apt_repository: repo: deb-src https://debian.ethz.ch/debian/ {{ ansible_distribution_release }} main non-free state: present when: - - base_pkg_non_free_firmware | bool - - not base_pkg_contrib | bool - - add_ethz | bool - - ansible_distribution == 'Debian' + - base__pkg_non_free_firmware | bool + - not base__pkg_contrib | bool - ansible_machine != 'armv6l' and ansible_distribution_release != 'wheezy' -- name: remove eth zurich apt - become: true - apt_repository: - repo: deb-src https://debian.ethz.ch/debian/ {{ ansible_distribution_release }} main non-free - state: absent - when: - - base_pkg_non_free_firmware | bool - - not base_pkg_contrib | bool - - not add_ethz | bool - - ansible_distribution == 'Debian' - - ansible_machine != 'armv6l' and ansible_distribution_release != 'wheezy' - -- name: add eth zurich apt + contrib + non-free +- name: add eth zurich apt (main contrib non-free) become: true apt_repository: repo: deb-src https://debian.ethz.ch/debian/ {{ ansible_distribution_release }} main contrib non-free state: present when: - - base_pkg_non_free_firmware | bool - - base_pkg_contrib | bool - - add_ethz | bool - - ansible_distribution == 'Debian' - - ansible_machine != 'armv6l' and ansible_distribution_release != 'wheezy' - -- name: remove eth zurich apt + contrib + non-free - become: true - apt_repository: - repo: deb-src https://debian.ethz.ch/debian/ {{ ansible_distribution_release }} main contrib non-free - state: absent - when: - - base_pkg_non_free_firmware | bool - - base_pkg_contrib | bool - - not add_ethz | bool - - ansible_distribution == 'Debian' + - base__pkg_non_free_firmware | bool + - base__pkg_contrib | bool - ansible_machine != 'armv6l' and ansible_distribution_release != 'wheezy'