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
This commit is contained in:
Jimmy McCrory 2016-01-14 14:04:49 -08:00
parent e474aa733a
commit c66d1641fd

View File

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