From 9ea1b06bfa070bba7c9984b56164674532359523 Mon Sep 17 00:00:00 2001 From: shaofeng_cheng Date: Sun, 13 Aug 2017 10:36:54 +0800 Subject: [PATCH] Remove service_providers in vpnaas_agent.ini Service_providers config group is already configured in the neutron_vpnaas.conf. So, we only need to load the neutron_vpnaas.conf configuration file when the neutron_vpnaas_agent container starts, without having to duplicate the configuration. Change-Id: I7b78831325db4bbb263b2cc174e848ea7037ad0a --- ansible/roles/neutron/handlers/main.yml | 3 +++ ansible/roles/neutron/tasks/config.yml | 18 +++++++++++------- .../neutron-vpnaas-agent-wrapper.sh.j2 | 1 + .../templates/neutron-vpnaas-agent.json.j2 | 6 ++++++ .../neutron/templates/vpnaas_agent.ini.j2 | 3 --- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ansible/roles/neutron/handlers/main.yml b/ansible/roles/neutron/handlers/main.yml index 847d1cec34..60b38a6f25 100644 --- a/ansible/roles/neutron/handlers/main.yml +++ b/ansible/roles/neutron/handlers/main.yml @@ -6,6 +6,7 @@ config_json: "{{ neutron_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}" neutron_conf: "{{ neutron_confs.results|selectattr('item.key', 'equalto', service_name)|first }}" neutron_lbaas_conf: "{{ neutron_lbaas_confs.results|selectattr('item.key', 'equalto', service_name)|first }}" + neutron_vpnaas_conf: "{{ neutron_vpnaas_confs.results|selectattr('item.key', 'equalto', service_name)|first }}" neutron_ml2_conf: "{{ neutron_ml2_confs.results|selectattr('item.key', 'equalto', service_name)|first }}" policy_json: "{{ policy_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}" neutron_server_container: "{{ check_neutron_containers.results|selectattr('item.key', 'equalto', service_name)|first }}" @@ -223,6 +224,7 @@ service: "{{ neutron_services[service_name] }}" config_json: "{{ neutron_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}" neutron_conf: "{{ neutron_confs.results|selectattr('item.key', 'equalto', service_name)|first }}" + neutron_vpnaas_conf: "{{ neutron_vpnaas_confs.results|selectattr('item.key', 'equalto', service_name)|first }}" neutron_l3_agent_ini: "{{ neutron_l3_agent_inis.results|selectattr('item.key', 'equalto', service_name)|first }}" neutron_fwaas_driver_ini: "{{ neutron_fwaas_driver_inis.results|selectattr('item.key', 'equalto', service_name)|first }}" policy_json: "{{ policy_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}" @@ -240,6 +242,7 @@ - service.host_in_groups | bool - config_json | changed or neutron_conf | changed + or neutron_vpnaas_conf | changed or neutron_l3_agent_ini | changed or neutron_fwaas_driver_ini | changed or neutron_vpnaas_agent_ini | changed diff --git a/ansible/roles/neutron/tasks/config.yml b/ansible/roles/neutron/tasks/config.yml index d721ea13b4..0919d2defd 100644 --- a/ansible/roles/neutron/tasks/config.yml +++ b/ansible/roles/neutron/tasks/config.yml @@ -90,20 +90,24 @@ - name: Copying over neutron_vpnaas.conf vars: - service_name: "neutron-server" - neutron_server: "{{ neutron_services[service_name] }}" + service_name: "{{ item.key }}" + services_need_neutron_vpnaas_conf: + - "neutron-server" + - "neutron-vpnaas-agent" merge_configs: sources: - "{{ role_path }}/templates/neutron_vpnaas.conf.j2" - "{{ node_custom_config }}/neutron/neutron_vpnaas.conf" - "{{ node_custom_config }}/neutron/{{ inventory_hostname }}/neutron_vpnaas.conf" - dest: "{{ node_config_directory }}/{{ service_name }}/neutron_vpnaas.conf" - register: neutron_vpnaas_conf + dest: "{{ node_config_directory }}/{{ item.key }}/neutron_vpnaas.conf" + register: neutron_vpnaas_confs when: - - neutron_server.enabled | bool - - neutron_server.host_in_groups | bool + - item.value.enabled | bool + - item.value.host_in_groups | bool + - item.key in services_need_neutron_vpnaas_conf + with_dict: "{{ neutron_services }}" notify: - - "Restart {{ service_name }} container" + - "Restart {{ item.key }} container" - name: Copying over ml2_conf.ini vars: diff --git a/ansible/roles/neutron/templates/neutron-vpnaas-agent-wrapper.sh.j2 b/ansible/roles/neutron/templates/neutron-vpnaas-agent-wrapper.sh.j2 index 23fe3dc67f..31b11d3c99 100644 --- a/ansible/roles/neutron/templates/neutron-vpnaas-agent-wrapper.sh.j2 +++ b/ansible/roles/neutron/templates/neutron-vpnaas-agent-wrapper.sh.j2 @@ -11,6 +11,7 @@ neutron-netns-cleanup \ neutron-vpn-agent \ --config-file /etc/neutron/neutron.conf \ + --config-file /etc/neutron/neutron_vpnaas.conf \ --config-file /etc/neutron/fwaas_driver.ini \ --config-file /etc/neutron/l3_agent.ini \ --config-file /etc/neutron/vpnaas_agent.ini diff --git a/ansible/roles/neutron/templates/neutron-vpnaas-agent.json.j2 b/ansible/roles/neutron/templates/neutron-vpnaas-agent.json.j2 index fce4ecd8ae..e5a64ab76b 100644 --- a/ansible/roles/neutron/templates/neutron-vpnaas-agent.json.j2 +++ b/ansible/roles/neutron/templates/neutron-vpnaas-agent.json.j2 @@ -13,6 +13,12 @@ "owner": "neutron", "perm": "0600" }, + { + "source": "{{ container_config_directory }}/neutron_vpnaas.conf", + "dest": "/etc/neutron/neutron_vpnaas.conf", + "owner": "neutron", + "perm": "0600" + }, { "source": "{{ container_config_directory }}/fwaas_driver.ini", "dest": "/etc/neutron/fwaas_driver.ini", diff --git a/ansible/roles/neutron/templates/vpnaas_agent.ini.j2 b/ansible/roles/neutron/templates/vpnaas_agent.ini.j2 index 5647ac2040..1e227eb383 100644 --- a/ansible/roles/neutron/templates/vpnaas_agent.ini.j2 +++ b/ansible/roles/neutron/templates/vpnaas_agent.ini.j2 @@ -4,8 +4,5 @@ [ipsec] enable_detailed_logging = {{ neutron_logging_debug }} -[service_providers] -service_provider = VPN:openswan:neutron_vpnaas.services.vpn.service_drivers.ipsec.IPsecVPNDriver:default - [vpnagent] vpn_device_driver = {{ vpn_device_driver }}