Updates syntax to Ansible 2.7 era

This commit is contained in:
Nikolaos Kakouros 2018-09-08 10:13:51 +02:00
parent b431459b45
commit 10f94a1f05
3 changed files with 16 additions and 12 deletions

View file

@ -1,7 +1,10 @@
---
- name: Reload the SSH service
service:
name: "{{ sshd_service }}"
state: reloaded
when: "sshd_allow_reload and ansible_virtualization_type|default(None) != 'docker'"
when:
- sshd_allow_reload
- ansible_virtualization_type|default(None) != 'docker'
listen: reload_sshd

View file

@ -2,13 +2,12 @@
- name: OS is supported
assert:
that: __sshd_os_supported == True
that: '__sshd_os_supported == True'
- name: Install ssh packages
package:
name: "{{ item }}"
name: "{{ sshd_packages }}"
state: present
with_items: "{{ sshd_packages }}"
- name: Configuration
template:
@ -44,5 +43,6 @@
when: "sshd_manage_service and ansible_virtualization_type|default(None) != 'docker'"
- 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

View file

@ -1,8 +1,9 @@
---
- name: Set OS dependent variables
include_vars: "{{ item }}"
with_first_found:
include_vars: "{{ lookup('first_found', var_files) }}"
vars:
var_files:
- "{{ ansible_distribution }}_{{ ansible_distribution_major_version }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}_{{ ansible_distribution_major_version }}.yml"