Merge pull request #92 from nkakouros-forks/syntax

Updates syntax to Ansible 2.7 era
This commit is contained in:
Matt Willsher 2019-07-10 19:32:29 +01:00 committed by GitHub
commit 003480d7b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 10 deletions

View file

@ -1,4 +1,5 @@
--- ---
- name: Reload the SSH service - name: Reload the SSH service
service: service:
name: "{{ sshd_service }}" name: "{{ sshd_service }}"

View file

@ -6,9 +6,8 @@
- name: Install ssh packages - name: Install ssh packages
package: package:
name: "{{ item }}" name: "{{ sshd_packages }}"
state: present state: present
with_items: "{{ sshd_packages }}"
- name: Configuration - name: Configuration
template: template:
@ -59,5 +58,6 @@
- ansible_distribution_major_version|int >= 7 - ansible_distribution_major_version|int >= 7
- name: Register that this role has run - 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 when: sshd_has_run is not defined

View file

@ -1,17 +1,19 @@
--- ---
- name: Set OS dependent variables - name: Set OS dependent variables
include_vars: "{{ item }}" include_vars: "{{ lookup('first_found', params) }}"
vars: vars:
ansible_distribution_lts_offset: '{{ ansible_distribution_lts_offset: >-
ansible_distribution_major_version|int % 2 {{
if ansible_distribution == "Ubuntu" ansible_distribution_major_version|int % 2
else 0 }}' if ansible_distribution == "Ubuntu"
else 0
}}
ansible_distribution_lts_version: '{{ ansible_distribution_lts_version: '{{
ansible_distribution_major_version|int - ansible_distribution_major_version|int -
ansible_distribution_lts_offset|int }}' ansible_distribution_lts_offset|int }}'
with_first_found: params:
- files: files:
- "{{ ansible_distribution }}_{{ ansible_distribution_lts_version }}.yml" - "{{ ansible_distribution }}_{{ ansible_distribution_lts_version }}.yml"
- "{{ ansible_distribution }}.yml" - "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}_{{ ansible_distribution_major_version }}.yml" - "{{ ansible_os_family }}_{{ ansible_distribution_major_version }}.yml"