diff --git a/ansible/roles/neutron/tasks/config.yml b/ansible/roles/neutron/tasks/config.yml index f6b1bcbb7f..dcda18180c 100644 --- a/ansible/roles/neutron/tasks/config.yml +++ b/ansible/roles/neutron/tasks/config.yml @@ -27,6 +27,12 @@ - item.value.host_in_groups | bool with_dict: "{{ neutron_services }}" +- name: Check if extra ml2 plugins exists + local_action: find path="{{ node_custom_config }}/neutron/plugins/" + run_once: True + changed_when: False + register: check_extra_ml2_plugins + - name: Copying over config.json files for services become: true template: @@ -419,6 +425,30 @@ notify: - "Restart {{ service_name }} container" +- name: Copying over extra ml2 plugins + become: true + vars: + service_name: "{{ item.0 }}" + services_need_ml2_conf_ini: + - "neutron-linuxbridge-agent" + - "neutron-openvswitch-agent" + - "neutron-server" + template: + src: "{{ item.2.path }}" + dest: "{{ node_config_directory }}/{{ service_name }}/{{ item.2.path | basename }}" + mode: "0660" + register: extra_ml2_plugins + when: + - item.2 is defined + - item.1.enabled | bool + - item.1.host_in_groups | bool + - service_name in services_need_ml2_conf_ini + with_nested: + - "{{ neutron_services | dictsort }}" + - "{{ check_extra_ml2_plugins.files }}" + notify: + - "Restart {{ item.0 }} container" + # TODO check the environment change - name: Check neutron containers kolla_docker: diff --git a/ansible/roles/neutron/templates/neutron-linuxbridge-agent.json.j2 b/ansible/roles/neutron/templates/neutron-linuxbridge-agent.json.j2 index 6dfd44811f..759a722566 100644 --- a/ansible/roles/neutron/templates/neutron-linuxbridge-agent.json.j2 +++ b/ansible/roles/neutron/templates/neutron-linuxbridge-agent.json.j2 @@ -13,6 +13,14 @@ "owner": "neutron", "perm": "0600" }, +{% if check_extra_ml2_plugins is defined and check_extra_ml2_plugins.matched > 0 %}{% for plugin in check_extra_ml2_plugins.files %} + { + "source": "{{ container_config_directory }}/{{ plugin.path | basename }}", + "dest": "/etc/neutron/plugins/ml2/{{ plugin.path | basename }}", + "owner": "neutron", + "perm": "0600" + }, +{% endfor %}{% endif %} { "source": "{{ container_config_directory }}/policy.json", "dest": "/etc/neutron/policy.json", diff --git a/ansible/roles/neutron/templates/neutron-openvswitch-agent.json.j2 b/ansible/roles/neutron/templates/neutron-openvswitch-agent.json.j2 index e5dfd784c7..8048c76901 100644 --- a/ansible/roles/neutron/templates/neutron-openvswitch-agent.json.j2 +++ b/ansible/roles/neutron/templates/neutron-openvswitch-agent.json.j2 @@ -13,6 +13,14 @@ "owner": "neutron", "perm": "0600" }, +{% if check_extra_ml2_plugins is defined and check_extra_ml2_plugins.matched > 0 %}{% for plugin in check_extra_ml2_plugins.files %} + { + "source": "{{ container_config_directory }}/{{ plugin.path | basename }}", + "dest": "/etc/neutron/plugins/ml2/{{ plugin.path | basename }}", + "owner": "neutron", + "perm": "0600" + }, +{% endfor %}{% endif %} { "source": "{{ container_config_directory }}/policy.json", "dest": "/etc/neutron/policy.json", diff --git a/ansible/roles/neutron/templates/neutron-server.json.j2 b/ansible/roles/neutron/templates/neutron-server.json.j2 index bf7272fd18..dc6a7317dd 100644 --- a/ansible/roles/neutron/templates/neutron-server.json.j2 +++ b/ansible/roles/neutron/templates/neutron-server.json.j2 @@ -31,6 +31,14 @@ "owner": "neutron", "perm": "0600" }, +{% if check_extra_ml2_plugins is defined and check_extra_ml2_plugins.matched > 0 %}{% for plugin in check_extra_ml2_plugins.files %} + { + "source": "{{ container_config_directory }}/{{ plugin.path | basename }}", + "dest": "/etc/neutron/plugins/ml2/{{ plugin.path | basename }}", + "owner": "neutron", + "perm": "0600" + }, +{% endfor %}{% endif %} { "source": "{{ container_config_directory }}/policy.json", "dest": "/etc/neutron/policy.json", diff --git a/releasenotes/notes/extra-ml2-plugins-817d0b392c06ffc7.yaml b/releasenotes/notes/extra-ml2-plugins-817d0b392c06ffc7.yaml new file mode 100644 index 0000000000..306a9bd447 --- /dev/null +++ b/releasenotes/notes/extra-ml2-plugins-817d0b392c06ffc7.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + Introduces support to use extra ml2 plugins non maintained + by kolla-ansible, an operator may add a file + ``/etc/kolla/config/neutron/plugins/awesome_plugin.ini`` and + will be copied into ml2 plugins folder during runtime.