diff --git a/defaults/main.yml b/defaults/main.yml index 2760d100..1848195b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -96,6 +96,7 @@ neutron_plugins: neutron_services: neutron-dhcp-agent: + group: neutron_dhcp_agent service_name: neutron-dhcp-agent service_en: True service_conf: dhcp_agent.ini @@ -105,6 +106,7 @@ neutron_services: config_overrides: "{{ neutron_dhcp_agent_ini_overrides }}" config_type: "ini" neutron-linuxbridge-agent: + group: neutron_linuxbridge_agent service_name: neutron-linuxbridge-agent service_en: True service_conf: plugins/ml2/linuxbridge_agent.ini @@ -114,6 +116,7 @@ neutron_services: config_overrides: "{{ neutron_linuxbridge_agent_ini_overrides }}" config_type: "ini" neutron-metadata-agent: + group: neutron_metadata_agent service_name: neutron-metadata-agent service_en: True service_conf: metadata_agent.ini @@ -122,6 +125,7 @@ neutron_services: config_overrides: "{{ neutron_metadata_agent_ini_overrides }}" config_type: "ini" neutron-metering-agent: + group: neutron_metering_agent service_name: neutron-metering-agent service_en: "{{ neutron_metering }}" service_conf: metering_agent.ini @@ -130,6 +134,7 @@ neutron_services: config_overrides: "{{ neutron_metering_agent_ini_overrides }}" config_type: "ini" neutron-l3-agent: + group: neutron_l3_agent service_name: neutron-l3-agent service_en: "{{ neutron_l3 }}" service_conf: l3_agent.ini @@ -139,6 +144,7 @@ neutron_services: config_overrides: "{{ neutron_l3_agent_ini_overrides }}" config_type: "ini" neutron-lbaas-agent: + group: neutron_lbaas_agent service_name: neutron-lbaas-agent service_en: "{{ neutron_lbaas }}" service_conf: lbaas_agent.ini @@ -148,6 +154,7 @@ neutron_services: config_overrides: "{{ neutron_lbaas_agent_ini_overrides }}" config_type: "ini" neutron-server: + group: neutron_server service_name: neutron-server service_en: True service_group: neutron_server diff --git a/tasks/main.yml b/tasks/main.yml index 779f9f1f..40646921 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -20,7 +20,7 @@ - include: neutron_db_setup.yml when: > - inventory_hostname == groups['neutron_server'][0] + inventory_hostname == groups[neutron_services['neutron-server']['group']][0] - include: neutron_service_setup.yml when: > @@ -28,7 +28,7 @@ - include: neutron_l3_ha.yml when: > - inventory_hostname in groups['neutron_agent'] + inventory_hostname in groups[neutron_services['neutron-l3-agent']['group']] - name: Flush handlers meta: flush_handlers diff --git a/tasks/neutron_db_setup.yml b/tasks/neutron_db_setup.yml index ca01379e..ed903f92 100644 --- a/tasks/neutron_db_setup.yml +++ b/tasks/neutron_db_setup.yml @@ -77,7 +77,7 @@ state: stopped pattern: "neutron-server" delegate_to: "{{ item }}" - with_items: groups['neutron_server'] + with_items: groups[neutron_services['neutron-server']['group']] when: (neutron_migrations is defined and neutron_migrations['run_contract']|bool) or neutron_plugin_type != 'ml2' tags: - neutron-db-setup @@ -121,7 +121,7 @@ state: started pattern: "neutron-server" delegate_to: "{{ item }}" - with_items: groups['neutron_server'] + with_items: groups[neutron_services['neutron-server']['group']] when: (neutron_migrations is defined and neutron_migrations['run_contract']|bool) or neutron_plugin_type != 'ml2' tags: - neutron-db-setup diff --git a/tasks/neutron_install.yml b/tasks/neutron_install.yml index f2e7c722..f24930a6 100644 --- a/tasks/neutron_install.yml +++ b/tasks/neutron_install.yml @@ -47,7 +47,7 @@ delay: 2 with_items: neutron_lbaas_apt_packages when: - - inventory_hostname in groups['neutron_agents_container'] + - inventory_hostname in groups[neutron_services['neutron-lbaas-agent']['group']] - neutron_lbaas | bool tags: - neutron-install diff --git a/tasks/neutron_post_install.yml b/tasks/neutron_post_install.yml index ddbb4fa1..50c17ca7 100644 --- a/tasks/neutron_post_install.yml +++ b/tasks/neutron_post_install.yml @@ -60,7 +60,7 @@ notify: - Restart neutron services when: > - inventory_hostname in groups['neutron_agents_container'] + inventory_hostname in groups[neutron_services['neutron-dhcp-agent']['group']] tags: - neutron-config @@ -79,8 +79,7 @@ when: - item.value.service_en | bool - item.value.service_conf is defined - - (inventory_hostname in groups['neutron_agents_container'] or - inventory_hostname in groups['neutron_linuxbridge_agent']) + - inventory_hostname in groups[item.value.group] tags: - neutron-config @@ -128,7 +127,7 @@ group: "root" mode: "0755" when: > - inventory_hostname in groups['neutron_linuxbridge_agent'] + inventory_hostname in groups[neutron_services['neutron-linuxbridge-agent']['group']] tags: - neutron-config - neutron-checksum-fix @@ -136,7 +135,7 @@ - name: Run iptables checksum fix command: /etc/network/if-up.d/post-up-checksum-rules when: > - inventory_hostname in groups['neutron_linuxbridge_agent'] + inventory_hostname in groups[neutron_services['neutron-linuxbridge-agent']['group']] tags: - neutron-config - neutron-checksum-fix diff --git a/tasks/neutron_upstart_init.yml b/tasks/neutron_upstart_init.yml index d5720ca6..ef47d726 100644 --- a/tasks/neutron_upstart_init.yml +++ b/tasks/neutron_upstart_init.yml @@ -22,7 +22,7 @@ system_group: "{{ neutron_system_group_name }}" service_home: "{{ neutron_system_home_folder }}" when: - - inventory_hostname in groups['neutron_server'] + - inventory_hostname in groups[neutron_services['neutron-server']['group']] - neutron_services['neutron-server'].service_en | bool tags: - upstart-init @@ -36,7 +36,7 @@ system_group: "{{ neutron_system_group_name }}" service_home: "{{ neutron_system_home_folder }}" when: - - inventory_hostname in groups['neutron_agent'] + - inventory_hostname in groups[neutron_services['neutron-dhcp-agent']['group']] - neutron_services['neutron-dhcp-agent'].service_en | bool tags: - upstart-init @@ -50,7 +50,7 @@ system_group: "{{ neutron_system_group_name }}" service_home: "{{ neutron_system_home_folder }}" when: - - inventory_hostname in groups['neutron_agent'] + - inventory_hostname in groups[neutron_services['neutron-l3-agent']['group']] - neutron_services['neutron-l3-agent'].service_en | bool tags: - upstart-init @@ -64,7 +64,7 @@ system_group: "{{ neutron_system_group_name }}" service_home: "{{ neutron_system_home_folder }}" when: - - inventory_hostname in groups['neutron_linuxbridge_agent'] + - inventory_hostname in groups[neutron_services['neutron-linuxbridge-agent']['group']] - neutron_services['neutron-linuxbridge-agent'].service_en | bool tags: - upstart-init @@ -78,7 +78,7 @@ system_group: "{{ neutron_system_group_name }}" service_home: "{{ neutron_system_home_folder }}" when: - - inventory_hostname in groups['neutron_agent'] + - inventory_hostname in groups[neutron_services['neutron-metadata-agent']['group']] - neutron_services['neutron-metadata-agent'].service_en | bool tags: - upstart-init @@ -92,7 +92,7 @@ system_group: "{{ neutron_system_group_name }}" service_home: "{{ neutron_system_home_folder }}" when: - - inventory_hostname in groups['neutron_agent'] + - inventory_hostname in groups[neutron_services['neutron-metering-agent']['group']] - neutron_services['neutron-metering-agent'].service_en | bool tags: - upstart-init @@ -106,7 +106,7 @@ system_group: "{{ neutron_system_group_name }}" service_home: "{{ neutron_system_home_folder }}" when: - - inventory_hostname in groups['neutron_agent'] + - inventory_hostname in groups[neutron_services['neutron-lbaas-agent']['group']] - neutron_services['neutron-lbaas-agent'].service_en | bool tags: - upstart-init diff --git a/tasks/plumgrid_config.yml b/tasks/plumgrid_config.yml index 744f99b3..c5935b4d 100644 --- a/tasks/plumgrid_config.yml +++ b/tasks/plumgrid_config.yml @@ -48,7 +48,7 @@ - "{{ neutron_optional_plumgrid_pip_packages }}" when: - neutron_venv_enabled | bool - - inventory_hostname in groups['neutron_server'] + - inventory_hostname in groups[neutron_services['neutron-server']['group']] tags: - neutron-install - neutron-pip-packages @@ -69,7 +69,7 @@ - "{{ neutron_optional_plumgrid_pip_packages }}" when: - neutron_venv_enabled | bool - - inventory_hostname in groups['neutron_server'] + - inventory_hostname in groups[neutron_services['neutron-server']['group']] tags: - neutron-install - neutron-pip-packages @@ -88,7 +88,7 @@ - "{{ neutron_optional_plumgrid_pip_packages }}" when: - not neutron_venv_enabled | bool - - inventory_hostname in groups['neutron_server'] + - inventory_hostname in groups[neutron_services['neutron-server']['group']] tags: - neutron-install - neutron-pip-packages @@ -107,7 +107,7 @@ - "{{ neutron_optional_plumgrid_pip_packages }}" when: - not neutron_venv_enabled | bool - - inventory_hostname in groups['neutron_server'] + - inventory_hostname in groups[neutron_services['neutron-server']['group']] tags: - neutron-install - neutron-pip-packages diff --git a/templates/neutron.conf.j2 b/templates/neutron.conf.j2 index 3baa115e..44912f63 100644 --- a/templates/neutron.conf.j2 +++ b/templates/neutron.conf.j2 @@ -10,7 +10,7 @@ debug = {{ debug }} fatal_deprecations = {{ neutron_fatal_deprecations }} log_file = /var/log/neutron/neutron.log -{% if inventory_hostname in groups['neutron_server'] %} +{% if inventory_hostname in groups[neutron_services['neutron-server']['group']] %} # General, only applies to neutron server host group network_device_mtu = {{ neutron_network_device_mtu }} @@ -48,7 +48,7 @@ router_distributed = False # Agents agent_down_time = {{ neutron_agent_down_time }} -{% set num_agent = groups['neutron_agent'] | length %} +{% set num_agent = groups[neutron_services['neutron-dhcp-agent']['group']] | length %} {% if neutron_plugin_type == 'ml2' and num_agent >= 2 %} {% if neutron_services['neutron-linuxbridge-agent']['service_en'] | bool %}