From 4a0f7d935a52579470c1ad006cd9d7e0a1adcefd Mon Sep 17 00:00:00 2001 From: Robert A Vincent II Date: Mon, 25 Feb 2019 15:45:15 -0500 Subject: [PATCH] Specify search path for os vars; support odd-numbered Ubuntu releases. --- meta/main.yml | 2 +- tasks/variables.yml | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/meta/main.yml b/meta/main.yml index 069b5cb..87933d8 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,7 +1,7 @@ --- galaxy_info: author: Matt Willsher - description: OpenSSH SSH deamon configuration + description: OpenSSH SSH daemon configuration company: Willsher Systems license: LGPLv3 min_ansible_version: 1.8 diff --git a/tasks/variables.yml b/tasks/variables.yml index 90ea62a..ccd71dd 100644 --- a/tasks/variables.yml +++ b/tasks/variables.yml @@ -2,12 +2,24 @@ - name: Set OS dependent variables include_vars: "{{ item }}" + vars: + ansible_distribution_lts_offset: '{{ + ansible_distribution_major_version|int % 2 + if ansible_distribution == "Ubuntu" + else 0 }}' + ansible_distribution_lts_version: '{{ + ansible_distribution_major_version|int - + ansible_distribution_lts_offset|int }}' with_first_found: - - "{{ ansible_distribution }}_{{ ansible_distribution_major_version }}.yml" - - "{{ ansible_distribution }}.yml" - - "{{ ansible_os_family }}_{{ ansible_distribution_major_version }}.yml" - - "{{ ansible_os_family }}.yml" - - default.yml + - files: + - "{{ ansible_distribution }}_{{ ansible_distribution_lts_version }}.yml" + - "{{ ansible_distribution }}.yml" + - "{{ ansible_os_family }}_{{ ansible_distribution_major_version }}.yml" + - "{{ ansible_os_family }}.yml" + - default.yml + paths: + - '{{ role_path }}/vars' + - '{{ playbook_dir }}/vars' - name: Override OS defaults block: