From a257ae73179d885d63d59d245e9294df4646103c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Tue, 24 Apr 2018 11:23:14 +0200 Subject: [PATCH] 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 --- handlers/main.yml | 2 +- tasks/main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 8976d48..2a437b4 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -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 diff --git a/tasks/main.yml b/tasks/main.yml index 3c8dc63..30c143d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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