From 2a12ea385e096e58f55875447748dd1cd59c1544 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/horizon_post_install.yml | 1 - tasks/horizon_ssl_user_provided.yml | 26 ++++++++++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/tasks/horizon_post_install.yml b/tasks/horizon_post_install.yml index d8175266..4411d13a 100644 --- a/tasks/horizon_post_install.yml +++ b/tasks/horizon_post_install.yml @@ -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 diff --git a/tasks/horizon_ssl_user_provided.yml b/tasks/horizon_ssl_user_provided.yml index b64607ac..0a49991e 100644 --- a/tasks/horizon_ssl_user_provided.yml +++ b/tasks/horizon_ssl_user_provided.yml @@ -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