From 7bb88390d88aebfc257e09e7e055a09fe4121782 Mon Sep 17 00:00:00 2001 From: Mauricio Lima Date: Fri, 11 Nov 2016 14:51:14 -0300 Subject: [PATCH] Fix copying nfs_shares configuration Using the `when` conditional on a `with_` loop gets evaluated on each loop iteration and will not skip a task entirely. Use the `skip` attribute to ignore errors in this scenario but only `skip` when `enable_cinder_backend_nfs` is not enabled. If it is enabled the `nfs_shares` file should be required and this task should fail if it does not exist. Co-authored-by: Andrew Widdersheim Change-Id: I6b997dd943efe7b16beb63899c1488fa5353d996 Closes-Bug: #1641183 --- ansible/roles/cinder/tasks/config.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ansible/roles/cinder/tasks/config.yml b/ansible/roles/cinder/tasks/config.yml index ecdd67c40e..9daa82c444 100644 --- a/ansible/roles/cinder/tasks/config.yml +++ b/ansible/roles/cinder/tasks/config.yml @@ -55,8 +55,9 @@ src: "{{ item }}" dest: "{{ node_config_directory }}/cinder-volume/nfs_shares" with_first_found: - - "{{ node_custom_config }}/nfs_shares.j2" - - "{{ node_custom_config }}/cinder/nfs_shares.j2" - - "{{ node_custom_config }}/cinder/cinder-volume/nfs_shares.j2" - - "{{ node_custom_config }}/cinder/{{ inventory_hostname }}/nfs_shares.j2" - when: enable_cinder_backend_nfs | bool + - files: + - "{{ node_custom_config }}/nfs_shares.j2" + - "{{ node_custom_config }}/cinder/nfs_shares.j2" + - "{{ node_custom_config }}/cinder/cinder-volume/nfs_shares.j2" + - "{{ node_custom_config }}/cinder/{{ inventory_hostname }}/nfs_shares.j2" + skip: "{{ not enable_cinder_backend_nfs | bool }}"