From c66d1641fd590d9553d02340d482a74f02285ec0 Mon Sep 17 00:00:00 2001 From: Jimmy McCrory Date: Thu, 14 Jan 2016 14:04:49 -0800 Subject: [PATCH] Cleanup syntax issues for Ansible 2 compatibility This patch fixes a few syntax issues required for Ansible 2 compatibility that Ansible 1.x was more lenient with. When a 'when' clause is combined with a 'with_*' statement, the clause is processed separately for each item. Tasks with 'when' clauses which depended on an item variable being defined have either applied a default empty value to the item or a new task individual task has been created for each item in the loop. Tasks within the os-cinder-install playboook have been updated to loop through cinder_backends as a hash. Change-Id: I9b53eb5dd709a6bed1797961015aa3dd328340f3 --- tasks/cinder_backends.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tasks/cinder_backends.yml b/tasks/cinder_backends.yml index 647d683a..5d20cba1 100644 --- a/tasks/cinder_backends.yml +++ b/tasks/cinder_backends.yml @@ -27,10 +27,9 @@ - name: Add in cinder devices types shell: | . {{ ansible_env.HOME }}/openrc - {{ cinder_bin }}/cinder type-create "{{ item.0 }}" - {{ cinder_bin }}/cinder type-key "{{ item.0 }}" set volume_backend_name="{{ item.1.volume_backend_name }}" - with_items: cinder_backends|dictsort - when: cinder_backends is defined + {{ cinder_bin }}/cinder type-create "{{ item.key }}" + {{ cinder_bin }}/cinder type-key "{{ item.key }}" set volume_backend_name="{{ item.value.volume_backend_name }}" + with_dict: cinder_backends|default({}) tags: - cinder-backends - cinder-backends-types