From 11eb950977ec71e407060468b7d524db4e3da870 Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Wed, 22 Nov 2017 09:04:44 +0100 Subject: [PATCH] return a bool instead of a list --- Manual.org | 6 +++--- roles/collect-facts/tasks/main.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Manual.org b/Manual.org index aa86c84..d1b71fc 100644 --- a/Manual.org +++ b/Manual.org @@ -560,15 +560,15 @@ APT::Install-Suggests "0"; - name: set variable nvidia_detected set_fact: - nvidia_detected: 'true if {{ gpus | selectattr("VendorName", "equalto", "nvidia") | list }} else false' + nvidia_detected: '{{ gpus | selectattr("VendorName", "equalto", "nvidia") | list | bool }}' - name: set variable intel_detected set_fact: - intel_detected: 'true if {{ gpus | selectattr("VendorName", "equalto", "intel") | list }} else false' + intel_detected: '{{ gpus | selectattr("VendorName", "equalto", "intel") | list | bool }}' - name: set variable amd_detected set_fact: - amd_detected: 'true if {{ gpus | selectattr("VendorName", "equalto", "amd") | list }} else false' + amd_detected: '{{ gpus | selectattr("VendorName", "equalto", "amd") | list | bool }}' - debug: var: '{{ item }}' diff --git a/roles/collect-facts/tasks/main.yml b/roles/collect-facts/tasks/main.yml index b1e6e7d..085e2f4 100644 --- a/roles/collect-facts/tasks/main.yml +++ b/roles/collect-facts/tasks/main.yml @@ -8,15 +8,15 @@ - name: set variable nvidia_detected set_fact: - nvidia_detected: 'true if {{ gpus | selectattr("VendorName", "equalto", "nvidia") | list }} else false' + nvidia_detected: '{{ gpus | selectattr("VendorName", "equalto", "nvidia") | list | bool }}' - name: set variable intel_detected set_fact: - intel_detected: 'true if {{ gpus | selectattr("VendorName", "equalto", "intel") | list }} else false' + intel_detected: '{{ gpus | selectattr("VendorName", "equalto", "intel") | list | bool }}' - name: set variable amd_detected set_fact: - amd_detected: 'true if {{ gpus | selectattr("VendorName", "equalto", "amd") | list }} else false' + amd_detected: '{{ gpus | selectattr("VendorName", "equalto", "amd") | list | bool }}' - debug: var: '{{ item }}'