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
This commit is contained in:
Duong Ha-Quang 2016-08-08 22:37:30 +07:00
parent aa5864fc40
commit 34975e291e
13 changed files with 58 additions and 58 deletions

View File

@ -59,8 +59,8 @@
{ name: ceilometer_notification, group: ceilometer-notification }, { name: ceilometer_notification, group: ceilometer-notification },
{ name: ceilometer_collector, group: ceilometer-collector }, { name: ceilometer_collector, group: ceilometer-collector },
{ name: ceilometer_compute, group: ceilometer-compute }] { name: ceilometer_compute, group: ceilometer-compute }]
- container_envs.results - "{{ container_envs.results }}"
- check_results.results - "{{ check_results.results }}"
- include: start.yml - include: start.yml
when: remove_containers.changed when: remove_containers.changed
@ -80,5 +80,5 @@
{ name: ceilometer_notification, group: ceilometer-notification }, { name: ceilometer_notification, group: ceilometer-notification },
{ name: ceilometer_collector, group: ceilometer-collector }, { name: ceilometer_collector, group: ceilometer-collector },
{ name: ceilometer_compute, group: ceilometer-compute }] { name: ceilometer_compute, group: ceilometer-compute }]
- container_envs.results - "{{ container_envs.results }}"
- check_results.results - "{{ check_results.results }}"

View File

@ -123,8 +123,8 @@
- item[2]['rc'] == 1 - item[2]['rc'] == 1
with_together: with_together:
- [{ name: ceph_mon, group: ceph-mon }] - [{ name: ceph_mon, group: ceph-mon }]
- ceph_mon_container_envs.results - "{{ ceph_mon_container_envs.results }}"
- ceph_mon_check_results.results - "{{ ceph_mon_check_results.results }}"
- name: Remove the ceph_osd containers - name: Remove the ceph_osd containers
kolla_docker: kolla_docker:
@ -137,9 +137,9 @@
- item[2]['rc'] == 1 - item[2]['rc'] == 1
- osds - osds
with_together: with_together:
- osd_ids.results - "{{ osd_ids.results }}"
- ceph_osd_container_envs.results - "{{ ceph_osd_container_envs.results }}"
- ceph_osd_check_results.results - "{{ ceph_osd_check_results.results }}"
- name: Remove the ceph_rgw container - name: Remove the ceph_rgw container
kolla_docker: kolla_docker:
@ -153,8 +153,8 @@
- item[2]['rc'] == 1 - item[2]['rc'] == 1
with_together: with_together:
- [{ name: ceph_rgw, group: ceph-rgw }] - [{ name: ceph_rgw, group: ceph-rgw }]
- ceph_rgw_container_envs.results - "{{ ceph_rgw_container_envs.results }}"
- ceph_rgw_check_results.results - "{{ ceph_rgw_check_results.results }}"
- include: start_mons.yml - include: start_mons.yml
when: when:
@ -181,8 +181,8 @@
- item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
- item[1]['rc'] == 1 - item[1]['rc'] == 1
with_together: with_together:
- ceph_mon_container_envs.results - "{{ ceph_mon_container_envs.results }}"
- ceph_mon_check_results.results - "{{ ceph_mon_check_results.results }}"
- name: Restart the ceph_osd container - name: Restart the ceph_osd container
kolla_docker: kolla_docker:
@ -195,9 +195,9 @@
- item[2]['rc'] == 1 - item[2]['rc'] == 1
- osds - osds
with_together: with_together:
- osd_ids.results - "{{ osd_ids.results }}"
- ceph_osd_container_envs.results - "{{ ceph_osd_container_envs.results }}"
- ceph_osd_check_results.results - "{{ ceph_osd_check_results.results }}"
- name: Restart the ceph_rgw container - name: Restart the ceph_rgw container
kolla_docker: kolla_docker:
@ -210,5 +210,5 @@
- item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
- item[1]['rc'] == 1 - item[1]['rc'] == 1
with_together: with_together:
- ceph_rgw_container_envs.results - "{{ ceph_rgw_container_envs.results }}"
- ceph_rgw_check_results.results - "{{ ceph_rgw_check_results.results }}"

View File

@ -46,6 +46,6 @@
- "/var/lib/ceph/osd/{{ item.1['fs_uuid'] }}:/var/lib/ceph/osd/ceph-{{ item.0.stdout }}" - "/var/lib/ceph/osd/{{ item.1['fs_uuid'] }}:/var/lib/ceph/osd/ceph-{{ item.0.stdout }}"
- "kolla_logs:/var/log/kolla/" - "kolla_logs:/var/log/kolla/"
with_together: with_together:
- id.results - "{{ id.results }}"
- osds - "{{ osds }}"
when: osds when: osds

View File

@ -40,8 +40,8 @@
- item[2]['rc'] == 1 - item[2]['rc'] == 1
with_together: with_together:
- "{{ glance_service_groups }}" - "{{ glance_service_groups }}"
- container_envs.results - "{{ container_envs.results }}"
- check_results.results - "{{ check_results.results }}"
- include: bootstrap_service.yml - include: bootstrap_service.yml
@ -59,5 +59,5 @@
- item[2]['rc'] == 1 - item[2]['rc'] == 1
with_together: with_together:
- "{{ glance_service_groups }}" - "{{ glance_service_groups }}"
- container_envs.results - "{{ container_envs.results }}"
- check_results.results - "{{ check_results.results }}"

View File

@ -51,8 +51,8 @@
- [{ name: heat_api, group: heat-api }, - [{ name: heat_api, group: heat-api },
{ name: heat_api_cfn, group: heat-api-cfn }, { name: heat_api_cfn, group: heat-api-cfn },
{ name: heat_engine, group: heat-engine }] { name: heat_engine, group: heat-engine }]
- container_envs.results - "{{ container_envs.results }}"
- check_results.results - "{{ check_results.results }}"
- include: start.yml - include: start.yml
when: remove_containers.changed when: remove_containers.changed
@ -70,5 +70,5 @@
- [{ name: heat_api, group: heat-api }, - [{ name: heat_api, group: heat-api },
{ name: heat_api_cfn, group: heat-api-cfn }, { name: heat_api_cfn, group: heat-api-cfn },
{ name: heat_engine, group: heat-engine }] { name: heat_engine, group: heat-engine }]
- container_envs.results - "{{ container_envs.results }}"
- check_results.results - "{{ check_results.results }}"

View File

@ -43,8 +43,8 @@
- inventory_hostname in groups[item[0]['group']] - inventory_hostname in groups[item[0]['group']]
with_together: with_together:
- [{ name: horizon, group: horizon }] - [{ name: horizon, group: horizon }]
- container_envs.results - "{{ container_envs.results }}"
- check_results.results - "{{ check_results.results }}"
- include: start.yml - include: start.yml
when: remove_containers.changed when: remove_containers.changed
@ -60,5 +60,5 @@
- inventory_hostname in groups[item[0]['group']] - inventory_hostname in groups[item[0]['group']]
with_together: with_together:
- [{ name: horizon, group: horizon }] - [{ name: horizon, group: horizon }]
- container_envs.results - "{{ container_envs.results }}"
- check_results.results - "{{ check_results.results }}"

View File

@ -43,8 +43,8 @@
- inventory_hostname in groups[item[0]['group']] - inventory_hostname in groups[item[0]['group']]
with_together: with_together:
- [{ name: keystone, group: keystone }] - [{ name: keystone, group: keystone }]
- container_envs.results - "{{ container_envs.results }}"
- check_results.results - "{{ check_results.results }}"
- include: start.yml - include: start.yml
when: remove_containers.changed when: remove_containers.changed
@ -60,5 +60,5 @@
- inventory_hostname in groups[item[0]['group']] - inventory_hostname in groups[item[0]['group']]
with_together: with_together:
- [{ name: keystone, group: keystone }] - [{ name: keystone, group: keystone }]
- container_envs.results - "{{ container_envs.results }}"
- check_results.results - "{{ check_results.results }}"

View File

@ -43,8 +43,8 @@
- inventory_hostname in groups[item[0]['group']] - inventory_hostname in groups[item[0]['group']]
with_together: with_together:
- [{ name: mariadb, group: mariadb }] - [{ name: mariadb, group: mariadb }]
- container_envs.results - "{{ container_envs.results }}"
- check_results.results - "{{ check_results.results }}"
- include: start.yml - include: start.yml
when: remove_containers.changed when: remove_containers.changed
@ -60,7 +60,7 @@
- inventory_hostname in groups[item[0]['group']] - inventory_hostname in groups[item[0]['group']]
with_together: with_together:
- [{ name: mariadb, group: mariadb }] - [{ name: mariadb, group: mariadb }]
- container_envs.results - "{{ container_envs.results }}"
- check_results.results - "{{ check_results.results }}"
- include: check.yml - include: check.yml

View File

@ -43,8 +43,8 @@
- inventory_hostname in groups[item[0]['group']] - inventory_hostname in groups[item[0]['group']]
with_together: with_together:
- [{ name: memcached, group: memcached }] - [{ name: memcached, group: memcached }]
- container_envs.results - "{{ container_envs.results }}"
- check_results.results - "{{ check_results.results }}"
- include: start.yml - include: start.yml
when: remove_containers.changed when: remove_containers.changed
@ -60,5 +60,5 @@
- inventory_hostname in groups[item[0]['group']] - inventory_hostname in groups[item[0]['group']]
with_together: with_together:
- [{ name: memcached, group: memcached }] - [{ name: memcached, group: memcached }]
- container_envs.results - "{{ container_envs.results }}"
- check_results.results - "{{ check_results.results }}"

View File

@ -182,8 +182,8 @@
{ name: neutron_l3_agent, group: neutron-l3-agent }, { name: neutron_l3_agent, group: neutron-l3-agent },
{ name: neutron_lbaas_agent, group: neutron-lbaas-agent, enabled: "{{ enable_neutron_lbaas | bool }}" }, { name: neutron_lbaas_agent, group: neutron-lbaas-agent, enabled: "{{ enable_neutron_lbaas | bool }}" },
{ name: neutron_metadata_agent, group: neutron-metadata-agent }] { name: neutron_metadata_agent, group: neutron-metadata-agent }]
- neutron_container_envs.results - "{{ neutron_container_envs.results }}"
- neutron_check_results.results - "{{ neutron_check_results.results }}"
- name: Remove the neutron_openvswitch_agent container - name: Remove the neutron_openvswitch_agent container
kolla_docker: kolla_docker:
@ -248,8 +248,8 @@
{ name: neutron_l3_agent, group: neutron-l3-agent }, { name: neutron_l3_agent, group: neutron-l3-agent },
{ name: neutron_lbaas_agent, group: neutron-lbaas-agent, enabled: "{{ enable_neutron_lbaas | bool }}" }, { name: neutron_lbaas_agent, group: neutron-lbaas-agent, enabled: "{{ enable_neutron_lbaas | bool }}" },
{ name: neutron_metadata_agent, group: neutron-metadata-agent }] { name: neutron_metadata_agent, group: neutron-metadata-agent }]
- neutron_container_envs.results - "{{ neutron_container_envs.results }}"
- neutron_check_results.results - "{{ neutron_check_results.results }}"
- name: Restart the neutron_openvswitch_agent container - name: Restart the neutron_openvswitch_agent container
kolla_docker: kolla_docker:

View File

@ -175,8 +175,8 @@
{ name: nova_api, group: nova-api }, { name: nova_api, group: nova-api },
{ name: nova_consoleauth, group: nova-consoleauth }, { name: nova_consoleauth, group: nova-consoleauth },
{ name: nova_scheduler, group: nova-scheduler }] { name: nova_scheduler, group: nova-scheduler }]
- container_envs.results - "{{ container_envs.results }}"
- check_results.results - "{{ check_results.results }}"
- name: Remove nova_compute container - name: Remove nova_compute container
kolla_docker: kolla_docker:
@ -266,8 +266,8 @@
{ name: nova_api, group: nova-api }, { name: nova_api, group: nova-api },
{ name: nova_consoleauth, group: nova-consoleauth }, { name: nova_consoleauth, group: nova-consoleauth },
{ name: nova_scheduler, group: nova-scheduler }] { name: nova_scheduler, group: nova-scheduler }]
- container_envs.results - "{{ container_envs.results }}"
- check_results.results - "{{ check_results.results }}"
- name: Restart the nova_compute container - name: Restart the nova_compute container
kolla_docker: kolla_docker:

View File

@ -3,10 +3,10 @@
command: "getent ahostsv4 {{ hostvars[item]['ansible_hostname'] }}" command: "getent ahostsv4 {{ hostvars[item]['ansible_hostname'] }}"
changed_when: false changed_when: false
register: rabbitmq_hostnames register: rabbitmq_hostnames
with_items: groups['rabbitmq'] with_items: "{{ groups['rabbitmq'] }}"
- fail: msg="Hostname has to resolve to IP address of api_interface" - 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 }}'" when: "'{{ hostvars[item['item']]['ansible_' + hostvars[item['item']]['api_interface']]['ipv4']['address'] }}' not in '{{ item.stdout }}'"
- name: Creating rabbitmq volume - name: Creating rabbitmq volume

View File

@ -43,8 +43,8 @@
- inventory_hostname in groups[item[0]['group']] - inventory_hostname in groups[item[0]['group']]
with_together: with_together:
- [{ name: rabbitmq, group: rabbitmq }] - [{ name: rabbitmq, group: rabbitmq }]
- container_envs.results - "{{ container_envs.results }}"
- check_results.results - "{{ check_results.results }}"
- include: start.yml - include: start.yml
when: remove_containers.changed when: remove_containers.changed
@ -60,5 +60,5 @@
- inventory_hostname in groups[item[0]['group']] - inventory_hostname in groups[item[0]['group']]
with_together: with_together:
- [{ name: rabbitmq, group: rabbitmq }] - [{ name: rabbitmq, group: rabbitmq }]
- container_envs.results - "{{ container_envs.results }}"
- check_results.results - "{{ check_results.results }}"