From 34975e291eeabb9645f3f338f7f9e5bb2efbe675 Mon Sep 17 00:00:00 2001
From: Duong Ha-Quang <duonghq@vn.fujitsu.com>
Date: Mon, 8 Aug 2016 22:37:30 +0700
Subject: [PATCH] Port with_ loop variable syntax  to Ansbile 2

Migrate to full variable syntax in with_ loop
instead of bare variables for:
- ceph
- ceilometer
- glance
- heat
- horizon
- keystone
- mariadb
- memcached
- neutron
- nova
- rabbitmq

Change-Id: Ib925b4ecea47ac758a77739c9c7e140f06933b08
Partial-Implements: blueprint ansible2
---
 .../roles/ceilometer/tasks/do_reconfigure.yml |  8 +++---
 ansible/roles/ceph/tasks/do_reconfigure.yml   | 28 +++++++++----------
 ansible/roles/ceph/tasks/start_osds.yml       |  4 +--
 ansible/roles/glance/tasks/do_reconfigure.yml |  8 +++---
 ansible/roles/heat/tasks/do_reconfigure.yml   |  8 +++---
 .../roles/horizon/tasks/do_reconfigure.yml    |  8 +++---
 .../roles/keystone/tasks/do_reconfigure.yml   |  8 +++---
 .../roles/mariadb/tasks/do_reconfigure.yml    |  8 +++---
 .../roles/memcached/tasks/do_reconfigure.yml  |  8 +++---
 .../roles/neutron/tasks/do_reconfigure.yml    |  8 +++---
 ansible/roles/nova/tasks/do_reconfigure.yml   |  8 +++---
 ansible/roles/rabbitmq/tasks/bootstrap.yml    |  4 +--
 .../roles/rabbitmq/tasks/do_reconfigure.yml   |  8 +++---
 13 files changed, 58 insertions(+), 58 deletions(-)

diff --git a/ansible/roles/ceilometer/tasks/do_reconfigure.yml b/ansible/roles/ceilometer/tasks/do_reconfigure.yml
index 137f1663dd..e0e1df5102 100644
--- a/ansible/roles/ceilometer/tasks/do_reconfigure.yml
+++ b/ansible/roles/ceilometer/tasks/do_reconfigure.yml
@@ -59,8 +59,8 @@
        { name: ceilometer_notification, group: ceilometer-notification },
        { name: ceilometer_collector, group: ceilometer-collector },
        { name: ceilometer_compute, group: ceilometer-compute }]
-    - container_envs.results
-    - check_results.results
+    - "{{ container_envs.results }}"
+    - "{{ check_results.results }}"
 
 - include: start.yml
   when: remove_containers.changed
@@ -80,5 +80,5 @@
        { name: ceilometer_notification, group: ceilometer-notification },
        { name: ceilometer_collector, group: ceilometer-collector },
        { name: ceilometer_compute, group: ceilometer-compute }]
-    - container_envs.results
-    - check_results.results
+    - "{{ container_envs.results }}"
+    - "{{ check_results.results }}"
diff --git a/ansible/roles/ceph/tasks/do_reconfigure.yml b/ansible/roles/ceph/tasks/do_reconfigure.yml
index e1c7999523..ee7a78779f 100644
--- a/ansible/roles/ceph/tasks/do_reconfigure.yml
+++ b/ansible/roles/ceph/tasks/do_reconfigure.yml
@@ -123,8 +123,8 @@
     - item[2]['rc'] == 1
   with_together:
     - [{ name: ceph_mon, group: ceph-mon }]
-    - ceph_mon_container_envs.results
-    - ceph_mon_check_results.results
+    - "{{ ceph_mon_container_envs.results }}"
+    - "{{ ceph_mon_check_results.results }}"
 
 - name: Remove the ceph_osd containers
   kolla_docker:
@@ -137,9 +137,9 @@
     - item[2]['rc'] == 1
     - osds
   with_together:
-    - osd_ids.results
-    - ceph_osd_container_envs.results
-    - ceph_osd_check_results.results
+    - "{{ osd_ids.results }}"
+    - "{{ ceph_osd_container_envs.results }}"
+    - "{{ ceph_osd_check_results.results }}"
 
 - name: Remove the ceph_rgw container
   kolla_docker:
@@ -153,8 +153,8 @@
     - item[2]['rc'] == 1
   with_together:
     - [{ name: ceph_rgw, group: ceph-rgw }]
-    - ceph_rgw_container_envs.results
-    - ceph_rgw_check_results.results
+    - "{{ ceph_rgw_container_envs.results }}"
+    - "{{ ceph_rgw_check_results.results }}"
 
 - include: start_mons.yml
   when:
@@ -181,8 +181,8 @@
     - item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
     - item[1]['rc'] == 1
   with_together:
-    - ceph_mon_container_envs.results
-    - ceph_mon_check_results.results
+    - "{{ ceph_mon_container_envs.results }}"
+    - "{{ ceph_mon_check_results.results }}"
 
 - name: Restart the ceph_osd container
   kolla_docker:
@@ -195,9 +195,9 @@
     - item[2]['rc'] == 1
     - osds
   with_together:
-    - osd_ids.results
-    - ceph_osd_container_envs.results
-    - ceph_osd_check_results.results
+    - "{{ osd_ids.results }}"
+    - "{{ ceph_osd_container_envs.results }}"
+    - "{{ ceph_osd_check_results.results }}"
 
 - name: Restart the ceph_rgw container
   kolla_docker:
@@ -210,5 +210,5 @@
     - item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
     - item[1]['rc'] == 1
   with_together:
-    - ceph_rgw_container_envs.results
-    - ceph_rgw_check_results.results
+    - "{{ ceph_rgw_container_envs.results }}"
+    - "{{ ceph_rgw_check_results.results }}"
diff --git a/ansible/roles/ceph/tasks/start_osds.yml b/ansible/roles/ceph/tasks/start_osds.yml
index c615cd6059..b5d6429874 100644
--- a/ansible/roles/ceph/tasks/start_osds.yml
+++ b/ansible/roles/ceph/tasks/start_osds.yml
@@ -46,6 +46,6 @@
       - "/var/lib/ceph/osd/{{ item.1['fs_uuid'] }}:/var/lib/ceph/osd/ceph-{{ item.0.stdout }}"
       - "kolla_logs:/var/log/kolla/"
   with_together:
-    - id.results
-    - osds
+    - "{{ id.results }}"
+    - "{{ osds }}"
   when: osds
diff --git a/ansible/roles/glance/tasks/do_reconfigure.yml b/ansible/roles/glance/tasks/do_reconfigure.yml
index 0e34c60db9..22f0eb79b5 100644
--- a/ansible/roles/glance/tasks/do_reconfigure.yml
+++ b/ansible/roles/glance/tasks/do_reconfigure.yml
@@ -40,8 +40,8 @@
     - item[2]['rc'] == 1
   with_together:
     - "{{ glance_service_groups }}"
-    - container_envs.results
-    - check_results.results
+    - "{{ container_envs.results }}"
+    - "{{ check_results.results }}"
 
 - include: bootstrap_service.yml
 
@@ -59,5 +59,5 @@
     - item[2]['rc'] == 1
   with_together:
     - "{{ glance_service_groups }}"
-    - container_envs.results
-    - check_results.results
+    - "{{ container_envs.results }}"
+    - "{{ check_results.results }}"
diff --git a/ansible/roles/heat/tasks/do_reconfigure.yml b/ansible/roles/heat/tasks/do_reconfigure.yml
index d1d69822fb..1e4bfeacd5 100644
--- a/ansible/roles/heat/tasks/do_reconfigure.yml
+++ b/ansible/roles/heat/tasks/do_reconfigure.yml
@@ -51,8 +51,8 @@
     - [{ name: heat_api, group: heat-api },
        { name: heat_api_cfn, group: heat-api-cfn },
        { name: heat_engine, group: heat-engine }]
-    - container_envs.results
-    - check_results.results
+    - "{{ container_envs.results }}"
+    - "{{ check_results.results }}"
 
 - include: start.yml
   when: remove_containers.changed
@@ -70,5 +70,5 @@
     - [{ name: heat_api, group: heat-api },
        { name: heat_api_cfn, group: heat-api-cfn },
        { name: heat_engine, group: heat-engine }]
-    - container_envs.results
-    - check_results.results
+    - "{{ container_envs.results }}"
+    - "{{ check_results.results }}"
diff --git a/ansible/roles/horizon/tasks/do_reconfigure.yml b/ansible/roles/horizon/tasks/do_reconfigure.yml
index 867f4ef194..e4ae77c07e 100644
--- a/ansible/roles/horizon/tasks/do_reconfigure.yml
+++ b/ansible/roles/horizon/tasks/do_reconfigure.yml
@@ -43,8 +43,8 @@
     - inventory_hostname in groups[item[0]['group']]
   with_together:
     - [{ name: horizon, group: horizon }]
-    - container_envs.results
-    - check_results.results
+    - "{{ container_envs.results }}"
+    - "{{ check_results.results }}"
 
 - include: start.yml
   when: remove_containers.changed
@@ -60,5 +60,5 @@
     - inventory_hostname in groups[item[0]['group']]
   with_together:
     - [{ name: horizon, group: horizon }]
-    - container_envs.results
-    - check_results.results
+    - "{{ container_envs.results }}"
+    - "{{ check_results.results }}"
diff --git a/ansible/roles/keystone/tasks/do_reconfigure.yml b/ansible/roles/keystone/tasks/do_reconfigure.yml
index 1a7d1650b7..a122875321 100644
--- a/ansible/roles/keystone/tasks/do_reconfigure.yml
+++ b/ansible/roles/keystone/tasks/do_reconfigure.yml
@@ -43,8 +43,8 @@
     - inventory_hostname in groups[item[0]['group']]
   with_together:
     - [{ name: keystone, group: keystone }]
-    - container_envs.results
-    - check_results.results
+    - "{{ container_envs.results }}"
+    - "{{ check_results.results }}"
 
 - include: start.yml
   when: remove_containers.changed
@@ -60,5 +60,5 @@
     - inventory_hostname in groups[item[0]['group']]
   with_together:
     - [{ name: keystone, group: keystone }]
-    - container_envs.results
-    - check_results.results
+    - "{{ container_envs.results }}"
+    - "{{ check_results.results }}"
diff --git a/ansible/roles/mariadb/tasks/do_reconfigure.yml b/ansible/roles/mariadb/tasks/do_reconfigure.yml
index 3819c3f7f0..92bf538c47 100644
--- a/ansible/roles/mariadb/tasks/do_reconfigure.yml
+++ b/ansible/roles/mariadb/tasks/do_reconfigure.yml
@@ -43,8 +43,8 @@
     - inventory_hostname in groups[item[0]['group']]
   with_together:
     - [{ name: mariadb, group: mariadb }]
-    - container_envs.results
-    - check_results.results
+    - "{{ container_envs.results }}"
+    - "{{ check_results.results }}"
 
 - include: start.yml
   when: remove_containers.changed
@@ -60,7 +60,7 @@
     - inventory_hostname in groups[item[0]['group']]
   with_together:
     - [{ name: mariadb, group: mariadb }]
-    - container_envs.results
-    - check_results.results
+    - "{{ container_envs.results }}"
+    - "{{ check_results.results }}"
 
 - include: check.yml
diff --git a/ansible/roles/memcached/tasks/do_reconfigure.yml b/ansible/roles/memcached/tasks/do_reconfigure.yml
index 8196394c7f..b63684beb7 100644
--- a/ansible/roles/memcached/tasks/do_reconfigure.yml
+++ b/ansible/roles/memcached/tasks/do_reconfigure.yml
@@ -43,8 +43,8 @@
     - inventory_hostname in groups[item[0]['group']]
   with_together:
     - [{ name: memcached, group: memcached }]
-    - container_envs.results
-    - check_results.results
+    - "{{ container_envs.results }}"
+    - "{{ check_results.results }}"
 
 - include: start.yml
   when: remove_containers.changed
@@ -60,5 +60,5 @@
     - inventory_hostname in groups[item[0]['group']]
   with_together:
     - [{ name: memcached, group: memcached }]
-    - container_envs.results
-    - check_results.results
+    - "{{ container_envs.results }}"
+    - "{{ check_results.results }}"
diff --git a/ansible/roles/neutron/tasks/do_reconfigure.yml b/ansible/roles/neutron/tasks/do_reconfigure.yml
index dc88b14566..adebc233a2 100644
--- a/ansible/roles/neutron/tasks/do_reconfigure.yml
+++ b/ansible/roles/neutron/tasks/do_reconfigure.yml
@@ -182,8 +182,8 @@
        { name: neutron_l3_agent, group: neutron-l3-agent },
        { name: neutron_lbaas_agent, group: neutron-lbaas-agent, enabled: "{{ enable_neutron_lbaas | bool }}" },
        { name: neutron_metadata_agent, group: neutron-metadata-agent }]
-    - neutron_container_envs.results
-    - neutron_check_results.results
+    - "{{ neutron_container_envs.results }}"
+    - "{{ neutron_check_results.results }}"
 
 - name: Remove the neutron_openvswitch_agent container
   kolla_docker:
@@ -248,8 +248,8 @@
        { name: neutron_l3_agent, group: neutron-l3-agent },
        { name: neutron_lbaas_agent, group: neutron-lbaas-agent, enabled: "{{ enable_neutron_lbaas | bool }}" },
        { name: neutron_metadata_agent, group: neutron-metadata-agent }]
-    - neutron_container_envs.results
-    - neutron_check_results.results
+    - "{{ neutron_container_envs.results }}"
+    - "{{ neutron_check_results.results }}"
 
 - name: Restart the neutron_openvswitch_agent container
   kolla_docker:
diff --git a/ansible/roles/nova/tasks/do_reconfigure.yml b/ansible/roles/nova/tasks/do_reconfigure.yml
index 8bbd369d70..2035fb0228 100644
--- a/ansible/roles/nova/tasks/do_reconfigure.yml
+++ b/ansible/roles/nova/tasks/do_reconfigure.yml
@@ -175,8 +175,8 @@
        { name: nova_api, group: nova-api },
        { name: nova_consoleauth, group: nova-consoleauth },
        { name: nova_scheduler, group: nova-scheduler }]
-    - container_envs.results
-    - check_results.results
+    - "{{ container_envs.results }}"
+    - "{{ check_results.results }}"
 
 - name: Remove nova_compute container
   kolla_docker:
@@ -266,8 +266,8 @@
        { name: nova_api, group: nova-api },
        { name: nova_consoleauth, group: nova-consoleauth },
        { name: nova_scheduler, group: nova-scheduler }]
-    - container_envs.results
-    - check_results.results
+    - "{{ container_envs.results }}"
+    - "{{ check_results.results }}"
 
 - name: Restart the nova_compute container
   kolla_docker:
diff --git a/ansible/roles/rabbitmq/tasks/bootstrap.yml b/ansible/roles/rabbitmq/tasks/bootstrap.yml
index ae615b12e0..d95c417495 100644
--- a/ansible/roles/rabbitmq/tasks/bootstrap.yml
+++ b/ansible/roles/rabbitmq/tasks/bootstrap.yml
@@ -3,10 +3,10 @@
   command: "getent ahostsv4 {{ hostvars[item]['ansible_hostname'] }}"
   changed_when: false
   register: rabbitmq_hostnames
-  with_items: groups['rabbitmq']
+  with_items: "{{ groups['rabbitmq'] }}"
 
 - fail: msg="Hostname has to resolve to IP address of api_interface"
-  with_items: rabbitmq_hostnames.results
+  with_items: "{{ rabbitmq_hostnames.results }}"
   when: "'{{ hostvars[item['item']]['ansible_' + hostvars[item['item']]['api_interface']]['ipv4']['address'] }}' not in '{{ item.stdout }}'"
 
 - name: Creating rabbitmq volume
diff --git a/ansible/roles/rabbitmq/tasks/do_reconfigure.yml b/ansible/roles/rabbitmq/tasks/do_reconfigure.yml
index 780f99d2f8..7524002b77 100644
--- a/ansible/roles/rabbitmq/tasks/do_reconfigure.yml
+++ b/ansible/roles/rabbitmq/tasks/do_reconfigure.yml
@@ -43,8 +43,8 @@
     - inventory_hostname in groups[item[0]['group']]
   with_together:
     - [{ name: rabbitmq, group: rabbitmq }]
-    - container_envs.results
-    - check_results.results
+    - "{{ container_envs.results }}"
+    - "{{ check_results.results }}"
 
 - include: start.yml
   when: remove_containers.changed
@@ -60,5 +60,5 @@
     - inventory_hostname in groups[item[0]['group']]
   with_together:
     - [{ name: rabbitmq, group: rabbitmq }]
-    - container_envs.results
-    - check_results.results
+    - "{{ container_envs.results }}"
+    - "{{ check_results.results }}"