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 2c18720487
commit 2a12ea385e
2 changed files with 18 additions and 9 deletions

View File

@ -53,7 +53,6 @@
src: "{{ item.value.src }}"
dest: "{{ horizon_lib_dir }}/openstack_dashboard/static/dashboard/{{ item.value.dest }}"
with_dict: "{{ horizon_custom_uploads | default({}) }}"
when: horizon_custom_uploads is defined
tags:
- horizon-branding

View File

@ -13,17 +13,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Drop user provided ssl cert and key
- name: Drop user provided ssl cert
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
src: "{{ horizon_user_ssl_cert }}"
dest: "{{ horizon_ssl_cert }}"
owner: "root"
group: "root"
mode: "{{ item.mode }}"
with_items:
- { src: "{{ horizon_user_ssl_cert }}", dest: "{{ horizon_ssl_cert }}", mode: "0644" }
- { src: "{{ horizon_user_ssl_key }}", dest: "{{ horizon_ssl_key }}", mode: "0640" }
when: horizon_user_ssl_cert is defined and horizon_user_ssl_key is defined
mode: "0644"
when: horizon_user_ssl_cert is defined
notify: Restart apache2
tags:
- horizon-configs
- horizon-ssl
- name: Drop user provided ssl key
copy:
src: "{{ horizon_user_ssl_key }}"
dest: "{{ horizon_ssl_key }}"
owner: "root"
group: "root"
mode: "0640"
when: horizon_user_ssl_key is defined
notify: Restart apache2
tags:
- horizon-configs