From ce9b53e40aca5773ac91a11930a59dae2f3ba67b Mon Sep 17 00:00:00 2001 From: Patrick Hasler Date: Thu, 18 Jul 2024 13:58:23 +0200 Subject: [PATCH] fix(vars): move OS-specific vars to separate files Ref: https://adfinis.github.io/ansible-guide/roles_collections.html#variables --- tasks/main.yml | 8 +++++++- vars/Debian.yml | 5 +++++ vars/main.yml | 15 +++------------ 3 files changed, 15 insertions(+), 13 deletions(-) create mode 100644 vars/Debian.yml diff --git a/tasks/main.yml b/tasks/main.yml index 97508a3..6a7edb4 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,10 +1,16 @@ --- # tasks file for bareos_sd +- name: Include OS-specific vars + ansible.builtin.include_vars: "{{ item }}" + with_first_found: + - "{{ ansible_facts.distribution }}_{{ ansible_facts.distribution_major_version }}.yml" + - "{{ ansible_facts.os_family }}.yml" + - name: Import assert.yml ansible.builtin.import_tasks: file: assert.yml - run_once: yes + run_once: true delegate_to: localhost - name: Install packages diff --git a/vars/Debian.yml b/vars/Debian.yml new file mode 100644 index 0000000..a3b68e6 --- /dev/null +++ b/vars/Debian.yml @@ -0,0 +1,5 @@ +--- + +bareos_sd_debug_packages: + - bareos-dbg + - gdb diff --git a/vars/main.yml b/vars/main.yml index c577c38..e562009 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -5,15 +5,6 @@ bareos_sd_packages: - bareos-storage - bareos-storage-tape -# A map to define the packages to install for debugging. -_bareos_sd_debug_packages: - default: - - bareos-storage-debuginfo - - gdb - Debian: - - bareos-dbg - - gdb - RedHat-7: - - bareos-debuginfo - - gdb -bareos_sd_debug_packages: "{{ _bareos_sd_debug_packages[ansible_os_family ~ '-' ~ ansible_distribution_major_version] | default(_bareos_sd_debug_packages[ansible_os_family] | default(_bareos_sd_debug_packages['default'])) }}" +bareos_sd_debug_packages: + - bareos-storage-debuginfo + - gdb