diff --git a/handlers/main.yml b/handlers/main.yml index c63b8b7..6b9a629 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,4 +1,5 @@ --- + - name: Reload the SSH service service: name: "{{ sshd_service }}" diff --git a/tasks/install.yml b/tasks/install.yml index 030177a..9a37548 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -6,9 +6,8 @@ - name: Install ssh packages package: - name: "{{ item }}" + name: "{{ sshd_packages }}" state: present - with_items: "{{ sshd_packages }}" - name: Configuration template: @@ -59,5 +58,6 @@ - ansible_distribution_major_version|int >= 7 - name: Register that this role has run - set_fact: sshd_has_run=true + set_fact: + sshd_has_run: true when: sshd_has_run is not defined diff --git a/tasks/variables.yml b/tasks/variables.yml index f0a586f..1de6c30 100644 --- a/tasks/variables.yml +++ b/tasks/variables.yml @@ -1,17 +1,19 @@ --- - name: Set OS dependent variables - include_vars: "{{ item }}" + include_vars: "{{ lookup('first_found', params) }}" vars: - ansible_distribution_lts_offset: '{{ - ansible_distribution_major_version|int % 2 - if ansible_distribution == "Ubuntu" - else 0 }}' + 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: - - files: + params: + files: - "{{ ansible_distribution }}_{{ ansible_distribution_lts_version }}.yml" - "{{ ansible_distribution }}.yml" - "{{ ansible_os_family }}_{{ ansible_distribution_major_version }}.yml"