From 64975e03e9fe3a3552db853b2e85ca7ab5e754e4 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Wed, 25 Nov 2015 08:13:04 -0500 Subject: [PATCH] Test for copy_hieradata being set Removing the default value from the variables file, while it allowed us to set the value in our file, did not let the role run when the value was not set. Test for being set. Change-Id: Ibe3ccecdbb5ff31108c4a95c9f9a5ca367663603 --- tasks/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 249cff9..05bd46a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -6,7 +6,7 @@ owner: root group: root mode: 0700 - when: copy_hieradata + when: copy_hieradata is defined and copy_hieradata - name: ensure hiera datadir - fqdn file: state: directory @@ -14,7 +14,7 @@ owner: root group: root mode: 0700 - when: copy_hieradata + when: copy_hieradata is defined and copy_hieradata - name: ensure hiera datadir - group file: state: directory @@ -22,12 +22,12 @@ owner: root group: root mode: 0700 - when: copy_hieradata + when: copy_hieradata is defined and copy_hieradata - name: make file list puppet_get_hiera_file_list: fqdn: "{{ inventory_hostname }}" groups: "{{ hostvars[inventory_hostname].group_names }}" - when: copy_hieradata + when: copy_hieradata is defined and copy_hieradata delegate_to: localhost register: hiera_file_paths - name: find which files exist @@ -36,9 +36,9 @@ register: st with_items: hiera_file_paths.paths_dict.paths delegate_to: localhost - when: copy_hieradata + when: copy_hieradata is defined and copy_hieradata - name: copy hiera files - when: copy_hieradata and item.1.stat.exists + when: copy_hieradata is defined and copy_hieradataand item.1.stat.exists copy: src: "{{ hieradata }}/{{ hieraenvironment }}/{{ item.1.item }}" dest: "{{ hieradata }}/{{ hieraenvironment }}/{{ item.1.item }}"