From f5aac61600ff83f9d4599ff978d68d95ac005022 Mon Sep 17 00:00:00 2001 From: Marc Becker Date: Wed, 6 Nov 2019 09:52:23 +0100 Subject: [PATCH 1/2] Fixing filter success --- tasks/main.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 6b550d0..fe8c219 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -4,9 +4,19 @@ register: __disk_config when: disk_discover_aws_nvme_ebs | default(True) | bool -- set_fact: - disk_additional_disks: "{{ __disk_config['ansible_facts']['config'] }}" - when: __disk_config is defined and __disk_config | success and 'ansible_facts' in __disk_config +- name: setting fact if ansible version is 2.5 or older + block: + - set_fact: + disk_additional_disks: "{{ __disk_config['ansible_facts']['config'] }}" + when: __disk_config is defined and __disk_config | success and 'ansible_facts' in __disk_config + when: ansible_version.full is version('2.5.0', '<=') + +- name: setting fact if ansible version is newer than 2.5 + block: + - set_fact: + disk_additional_disks: "{{ __disk_config['ansible_facts']['config'] }}" + when: __disk_config is defined and __disk_config is not successful and 'ansible_facts' in __disk_config + when: ansible_version.full is version('2.5.0', '>') - name: "Install parted" package: From 1dd682f4f46bce8536fcb149cc396d4a4a260b60 Mon Sep 17 00:00:00 2001 From: Marc Becker Date: Thu, 7 Nov 2019 07:40:16 +0100 Subject: [PATCH 2/2] Fixing check for ansible version --- tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index fe8c219..63675cf 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -9,14 +9,14 @@ - set_fact: disk_additional_disks: "{{ __disk_config['ansible_facts']['config'] }}" when: __disk_config is defined and __disk_config | success and 'ansible_facts' in __disk_config - when: ansible_version.full is version('2.5.0', '<=') + when: ansible_version.full is version('2.5.0', '<') - name: setting fact if ansible version is newer than 2.5 block: - set_fact: disk_additional_disks: "{{ __disk_config['ansible_facts']['config'] }}" when: __disk_config is defined and __disk_config is not successful and 'ansible_facts' in __disk_config - when: ansible_version.full is version('2.5.0', '>') + when: ansible_version.full is version('2.5.0', '>=') - name: "Install parted" package: