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 <amwiddersheim@gmail.com>
Change-Id: I6b997dd943efe7b16beb63899c1488fa5353d996
Closes-Bug: #1641183
This commit is contained in:
Mauricio Lima 2016-11-11 14:51:14 -03:00 committed by Andrew Widdersheim
parent 9099b8be4d
commit 7bb88390d8
1 changed files with 6 additions and 5 deletions

View File

@ -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 }}"