Fix for ansible_virtualization_type not defined in Ansible > 2.5

ansible_virtualization_type is undefined in Ansible > 2.5 when no virtualization
is used. A jinja2 filter has been added that provides a default value (None) so
that the check does not fail
This commit is contained in:
Dan Čermák 2018-04-24 11:23:14 +02:00
parent 77768eb9f4
commit a257ae7317
2 changed files with 2 additions and 2 deletions

View file

@ -3,5 +3,5 @@
service:
name: "{{ sshd_service }}"
state: reloaded
when: sshd_allow_reload and ansible_virtualization_type != 'docker'
when: "sshd_allow_reload and ansible_virtualization_type|default(None) != 'docker'"
listen: reload_sshd

View file

@ -33,7 +33,7 @@
name: "{{ sshd_service }}"
enabled: true
state: started
when: sshd_manage_service and ansible_virtualization_type != 'docker'
when: "sshd_manage_service and ansible_virtualization_type|default(None) != 'docker'"
- name: Register that this role has run
set_fact: sshd_has_run=true