From d0854ce5d5ad824b05dbb30f55d61729846ae878 Mon Sep 17 00:00:00 2001 From: Monty Taylor <mordred@inaugust.com> Date: Tue, 19 Jan 2016 08:03:57 -0500 Subject: [PATCH] Properly suppress undefined warning Although there is no harm in this case, the task in question has a with_items on a variable that is not set because the previous task did not run. In this case, it did not run because it's in a block with a when that did not match - but in the context of a task, when is applied after with_items and is applied to each with_item, rather than to the task as a whole. To make the task complete, add a |default() jinja filter so that the undefined variable is replaced with a defined but empty value. Change-Id: I2029b7cac3634a5fe7232f6f823e803e1f4250e6 --- tasks/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index f4a4e58..affcd4b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -24,8 +24,7 @@ src: "{{ item }}" dest: "{{ item }}" mode: 0600 - with_items: hiera_file_paths.paths - when: hiera_file_paths is defined + with_items: hiera_file_paths.paths|default() - name: ensure hieradata manifest link is present file: