Use known group names

Avoid assuming that provider or deployment specific groups are defined
in inventory by making use of the group names defined in the
'neutron_services' var and checking group membership through a host's
group_names instead of Ansible's groups dictionary.

Change-Id: I66b7c639494d98fdb3baa52fe56c670e32dea3ce
This commit is contained in:
Jimmy McCrory 2017-11-13 08:40:17 -08:00
parent e38c2e09f5
commit c03c932c9b
9 changed files with 6 additions and 16 deletions

View File

@ -58,4 +58,4 @@ dependencies:
extra_features: "{{ opendaylight_extra_features }}"
when:
- neutron_plugin_type == "ml2.opendaylight"
- inventory_hostname in groups["opendaylight"]
- "'opendaylight' in group_names"

View File

@ -73,5 +73,5 @@
tags:
- dragonflow-config
when:
- (inventory_hostname in groups[neutron_services['dragonflow-l3-agent']['group']]) or
(inventory_hostname in groups[neutron_services['dragonflow-controller-agent']['group']])
- (neutron_services['dragonflow-l3-agent']['group'] in group_names) or
(neutron_services['dragonflow-controller-agent']['group'] in group_names)

View File

@ -32,4 +32,4 @@
- opendaylight-pip-packages
- include: setup_ovs_opendaylight.yml
when: (inventory_hostname in groups['neutron_agents_container'] or inventory_hostname in groups['compute_hosts'])
when: neutron_services['neutron-server']['group'] not in group_names

View File

@ -56,8 +56,6 @@ server2
[neutron_l3_agent]
[neutron_lbaas_agent]
[neutron_metadata_agent]
[neutron_agents_container]
[compute_hosts]
[neutron_all:children]
neutron_agent

View File

@ -63,8 +63,6 @@ agents2
[neutron_l3_agent]
[neutron_lbaas_agent]
[neutron_metadata_agent]
[neutron_agents_container]
[compute_hosts]
[neutron_all:children]
neutron_agent

View File

@ -68,8 +68,6 @@ server1
server2
[neutron_calico_dhcp_agent]
[neutron_agents_container]
[compute_hosts]
[neutron_all:children]
neutron_agent

View File

@ -46,8 +46,6 @@ server1
[neutron_l3_agent]
[neutron_lbaas_agent]
[neutron_metadata_agent]
[neutron_agents_container]
[compute_hosts]
[neutron_all:children]
neutron_agent

View File

@ -68,8 +68,6 @@ server1
server2
[neutron_calico_dhcp_agent]
[neutron_agents_container]
[compute_hosts]
[neutron_all:children]
neutron_agent

View File

@ -27,7 +27,7 @@ neutron_package_list: |-
{% if (neutron_services['neutron-openvswitch-agent']['group'] in group_names and neutron_services['neutron-openvswitch-agent'].service_en | bool)
or (neutron_services['dragonflow-controller-agent']['group'] in group_names and neutron_services['dragonflow-controller-agent'].service_en | bool)
or (neutron_services['dragonflow-l3-agent']['group'] in group_names and neutron_services['dragonflow-l3-agent'].service_en | bool)
or ((inventory_hostname in groups['neutron_agents_container'] or inventory_hostname in groups['compute_hosts']) and neutron_plugin_type == 'ml2.opendaylight') %}
or ((neutron_services['neutron-server']['group'] not in group_names) and neutron_plugin_type == 'ml2.opendaylight') %}
{% set _ = packages.extend(neutron_ovs_distro_packages) %}
{% endif %}
{% if neutron_services['neutron-linuxbridge-agent']['group'] in group_names and neutron_services['neutron-linuxbridge-agent'].service_en | bool %}
@ -241,7 +241,7 @@ opendaylight_install_method: "{{ (ansible_os_family=='Debian') | ternary('deb_re
ovs_manager_list: |-
{% set ovs_managers_odls = [] %}
{% for host in groups["neutron_server_container"] %}
{% for host in neutron_services['neutron-server']['group'] %}
{% set odl_ip_address = hostvars[host]['container_address']|string %}
{% set _ = ovs_managers_odls.append('tcp:' + odl_ip_address + ':6640') %}
{% endfor %}