From e297345a34b9332e9b1a093127f71658272c3b2a Mon Sep 17 00:00:00 2001 From: L3D Date: Tue, 23 Mar 2021 16:16:20 +0100 Subject: [PATCH] change how to ged os specific vars --- tasks/main.yml | 23 +---------------------- vars/main.yml | 11 +++++++++++ 2 files changed, 12 insertions(+), 22 deletions(-) create mode 100644 vars/main.yml diff --git a/tasks/main.yml b/tasks/main.yml index 685812e..668200f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,27 +1,6 @@ --- -# tasks file for skeleton - - name: add OS specific variables - include_vars: '{{ loop_vars }}' - with_first_found: - - files: - - '{{ distribution }}-{{ distribution_version }}.yml' - - '{{ distribution }}-{{ distribution_major_version }}.yml' - - '{{ distribution }}.yml' - - '{{ ansible_os_family }}.yml' - - '{{ ansible_system }}.yml' - - 'defaults.yml' - paths: - - 'vars' - loop_control: - loop_var: loop_vars - vars: - distribution: '{{ ansible_distribution }}' - distribution_version: '{{ ansible_distribution_version }}' - distribution_major_version: '{{ ansible_distribution_major_version }}' - tags: - - configuration - - packages + ansible.builtin.include_vars: "{{ lookup('first_found', restic_os_variables) }}" - name: Ensure restic directories exist file: diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..a9c0aa5 --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,11 @@ +--- +restic_os_variables: + files: + - '{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml' + - '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml' + - '{{ distribution }}.yml' + - '{{ ansible_os_family }}.yml' + - '{{ ansible_system }}.yml' + - 'defaults.yml' + paths: + - 'vars'