diff --git a/ansible/roles/ovn-controller/defaults/main.yml b/ansible/roles/ovn-controller/defaults/main.yml new file mode 100644 index 0000000000..b97b4ccbac --- /dev/null +++ b/ansible/roles/ovn-controller/defaults/main.yml @@ -0,0 +1,38 @@ +--- +ovn_controller_services: + ovn-controller: + container_name: ovn_controller + group: ovn-controller + enabled: true + image: "{{ ovn_controller_image_full }}" + volumes: "{{ ovn_controller_default_volumes + ovn_controller_extra_volumes }}" + dimensions: "{{ ovn_controller_dimensions }}" + +#################### +# Docker +#################### +ovn_tag: "{{ openstack_tag }}" + +ovn_controller_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/ovn-controller" +ovn_controller_tag: "{{ ovn_tag }}" +ovn_controller_image_full: "{{ ovn_controller_image }}:{{ ovn_controller_tag }}" + +ovn_controller_dimensions: "{{ default_container_dimensions }}" + +ovn_controller_default_volumes: + - "{{ node_config_directory }}/ovn-controller/:{{ container_config_directory }}/:ro" + - "/run/openvswitch:/run/openvswitch:shared" + - "/etc/localtime:/etc/localtime:ro" + - "kolla_logs:/var/log/kolla/" + +ovn_controller_extra_volumes: "{{ default_extra_volumes }}" + +##### +# OVN +##### +# Base MAC for ovn-chassis-mac-mappings generation +ovn_base_mac: "52:54:00" +# Configure OVN remote probe interval time in ms +ovn_remote_probe_interval: "60000" +# Configure OVN openflow interval in s +ovn_openflow_probe_interval: "60" diff --git a/ansible/roles/ovn-controller/handlers/main.yml b/ansible/roles/ovn-controller/handlers/main.yml new file mode 100644 index 0000000000..165e7c0d37 --- /dev/null +++ b/ansible/roles/ovn-controller/handlers/main.yml @@ -0,0 +1,15 @@ +--- +- name: Restart ovn-controller container + vars: + service_name: "ovn-controller" + service: "{{ ovn_controller_services[service_name] }}" + become: true + kolla_docker: + action: "recreate_or_restart_container" + common_options: "{{ docker_common_options }}" + name: "{{ service.container_name }}" + image: "{{ service.image }}" + volumes: "{{ service.volumes | reject('equalto', '') | list }}" + dimensions: "{{ service.dimensions }}" + when: + - kolla_action != "config" diff --git a/ansible/roles/ovn-controller/tasks/check-containers.yml b/ansible/roles/ovn-controller/tasks/check-containers.yml new file mode 100644 index 0000000000..a7cef3d950 --- /dev/null +++ b/ansible/roles/ovn-controller/tasks/check-containers.yml @@ -0,0 +1,16 @@ +--- +- name: Check ovn-controller containers + become: true + kolla_docker: + action: "compare_container" + common_options: "{{ docker_common_options }}" + name: "{{ item.value.container_name }}" + image: "{{ item.value.image }}" + volumes: "{{ item.value.volumes | reject('equalto', '') | list }}" + dimensions: "{{ item.value.dimensions }}" + when: + - inventory_hostname in groups[item.value.group] + - item.value.enabled | bool + with_dict: "{{ ovn_controller_services }}" + notify: + - Restart {{ item.key }} container diff --git a/ansible/roles/ovn-controller/tasks/config.yml b/ansible/roles/ovn-controller/tasks/config.yml new file mode 100644 index 0000000000..fa4617efea --- /dev/null +++ b/ansible/roles/ovn-controller/tasks/config.yml @@ -0,0 +1,26 @@ +--- +- name: Ensuring config directories exist + file: + path: "{{ node_config_directory }}/{{ item.key }}" + state: "directory" + owner: "{{ config_owner_user }}" + group: "{{ config_owner_group }}" + mode: "0770" + become: true + when: + - inventory_hostname in groups[item.value.group] + - item.value.enabled | bool + with_dict: "{{ ovn_controller_services }}" + +- name: Copying over config.json files for services + template: + src: "{{ item.key }}.json.j2" + dest: "{{ node_config_directory }}/{{ item.key }}/config.json" + mode: "0660" + become: true + when: + - inventory_hostname in groups[item.value.group] + - item.value.enabled | bool + with_dict: "{{ ovn_controller_services }}" + notify: + - Restart {{ item.key }} container diff --git a/ansible/roles/ovn/tasks/deploy-containers.yml b/ansible/roles/ovn-controller/tasks/deploy-containers.yml similarity index 100% rename from ansible/roles/ovn/tasks/deploy-containers.yml rename to ansible/roles/ovn-controller/tasks/deploy-containers.yml diff --git a/ansible/roles/ovn/tasks/deploy.yml b/ansible/roles/ovn-controller/tasks/deploy.yml similarity index 57% rename from ansible/roles/ovn/tasks/deploy.yml rename to ansible/roles/ovn-controller/tasks/deploy.yml index 3356de912e..52482569d5 100644 --- a/ansible/roles/ovn/tasks/deploy.yml +++ b/ansible/roles/ovn-controller/tasks/deploy.yml @@ -3,8 +3,7 @@ - import_tasks: check-containers.yml -- import_tasks: bootstrap.yml - when: inventory_hostname in groups['ovn-controller'] +- import_tasks: setup-ovs.yml - name: Flush handlers meta: flush_handlers diff --git a/ansible/roles/ovn/tasks/main.yml b/ansible/roles/ovn-controller/tasks/main.yml similarity index 100% rename from ansible/roles/ovn/tasks/main.yml rename to ansible/roles/ovn-controller/tasks/main.yml diff --git a/ansible/roles/ovn/tasks/check.yml b/ansible/roles/ovn-controller/tasks/precheck.yml similarity index 100% rename from ansible/roles/ovn/tasks/check.yml rename to ansible/roles/ovn-controller/tasks/precheck.yml diff --git a/ansible/roles/ovn/tasks/pull.yml b/ansible/roles/ovn-controller/tasks/pull.yml similarity index 100% rename from ansible/roles/ovn/tasks/pull.yml rename to ansible/roles/ovn-controller/tasks/pull.yml diff --git a/ansible/roles/ovn/tasks/reconfigure.yml b/ansible/roles/ovn-controller/tasks/reconfigure.yml similarity index 100% rename from ansible/roles/ovn/tasks/reconfigure.yml rename to ansible/roles/ovn-controller/tasks/reconfigure.yml diff --git a/ansible/roles/ovn/tasks/bootstrap.yml b/ansible/roles/ovn-controller/tasks/setup-ovs.yml similarity index 100% rename from ansible/roles/ovn/tasks/bootstrap.yml rename to ansible/roles/ovn-controller/tasks/setup-ovs.yml diff --git a/ansible/roles/ovn-controller/tasks/stop.yml b/ansible/roles/ovn-controller/tasks/stop.yml new file mode 100644 index 0000000000..25f85ac67d --- /dev/null +++ b/ansible/roles/ovn-controller/tasks/stop.yml @@ -0,0 +1,6 @@ +--- +- import_role: + role: service-stop + vars: + project_services: "{{ ovn_controller_services }}" + service_name: "{{ project_name }}" diff --git a/ansible/roles/ovn-controller/tasks/upgrade.yml b/ansible/roles/ovn-controller/tasks/upgrade.yml new file mode 100644 index 0000000000..5b10a7e111 --- /dev/null +++ b/ansible/roles/ovn-controller/tasks/upgrade.yml @@ -0,0 +1,2 @@ +--- +- import_tasks: deploy.yml diff --git a/ansible/roles/ovn/templates/ovn-controller.json.j2 b/ansible/roles/ovn-controller/templates/ovn-controller.json.j2 similarity index 100% rename from ansible/roles/ovn/templates/ovn-controller.json.j2 rename to ansible/roles/ovn-controller/templates/ovn-controller.json.j2 diff --git a/ansible/roles/ovn-controller/vars/main.yml b/ansible/roles/ovn-controller/vars/main.yml new file mode 100644 index 0000000000..fbb32f1197 --- /dev/null +++ b/ansible/roles/ovn-controller/vars/main.yml @@ -0,0 +1,6 @@ +--- +project_name: "ovn" + +# NOTE(mnasiadka): we need this for the ovn-controller role +# because this role's vars prefix does not match "{{ project_name }}" +kolla_role_name: "ovn_controller" diff --git a/ansible/roles/ovn/defaults/main.yml b/ansible/roles/ovn-db/defaults/main.yml similarity index 62% rename from ansible/roles/ovn/defaults/main.yml rename to ansible/roles/ovn-db/defaults/main.yml index 394cb744b2..7ce7895815 100644 --- a/ansible/roles/ovn/defaults/main.yml +++ b/ansible/roles/ovn-db/defaults/main.yml @@ -1,12 +1,5 @@ --- -ovn_services: - ovn-controller: - container_name: ovn_controller - group: ovn-controller - enabled: true - image: "{{ ovn_controller_image_full }}" - volumes: "{{ ovn_controller_default_volumes + ovn_controller_extra_volumes }}" - dimensions: "{{ ovn_controller_dimensions }}" +ovn_db_services: ovn-northd: container_name: ovn_northd group: ovn-northd @@ -35,10 +28,6 @@ ovn_services: #################### ovn_tag: "{{ openstack_tag }}" -ovn_controller_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/ovn-controller" -ovn_controller_tag: "{{ ovn_tag }}" -ovn_controller_image_full: "{{ ovn_controller_image }}:{{ ovn_controller_tag }}" - ovn_northd_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/ovn-northd" ovn_northd_tag: "{{ ovn_tag }}" ovn_northd_image_full: "{{ ovn_northd_image }}:{{ ovn_northd_tag }}" @@ -51,16 +40,10 @@ ovn_sb_db_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docke ovn_sb_db_tag: "{{ ovn_tag }}" ovn_sb_db_image_full: "{{ ovn_sb_db_image }}:{{ ovn_sb_db_tag }}" -ovn_controller_dimensions: "{{ default_container_dimensions }}" ovn_northd_dimensions: "{{ default_container_dimensions }}" ovn_nb_db_dimensions: "{{ default_container_dimensions }}" ovn_sb_db_dimensions: "{{ default_container_dimensions }}" -ovn_controller_default_volumes: - - "{{ node_config_directory }}/ovn-controller/:{{ container_config_directory }}/:ro" - - "/run/openvswitch:/run/openvswitch:shared" - - "/etc/localtime:/etc/localtime:ro" - - "kolla_logs:/var/log/kolla/" ovn_northd_default_volumes: - "{{ node_config_directory }}/ovn-northd/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" @@ -76,18 +59,7 @@ ovn_sb_db_default_volumes: - "ovn_sb_db:/var/lib/openvswitch/ovn-sb/" - "kolla_logs:/var/log/kolla/" -ovn_extra_volumes: "{{ default_extra_volumes }}" -ovn_controller_extra_volumes: "{{ ovn_extra_volumes }}" -ovn_northd_extra_volumes: "{{ ovn_extra_volumes }}" -ovn_nb_db_extra_volumes: "{{ ovn_extra_volumes }}" -ovn_sb_db_extra_volumes: "{{ ovn_extra_volumes }}" - -##### -# OVN -##### -# Base MAC for ovn-chassis-mac-mappings generation -ovn_base_mac: "52:54:00" -# Configure OVN remote probe interval time in ms -ovn_remote_probe_interval: "60000" -# Configure OVN openflow interval in s -ovn_openflow_probe_interval: "60" +ovn_db_extra_volumes: "{{ default_extra_volumes }}" +ovn_northd_extra_volumes: "{{ ovn_db_extra_volumes }}" +ovn_nb_db_extra_volumes: "{{ ovn_db_extra_volumes }}" +ovn_sb_db_extra_volumes: "{{ ovn_db_extra_volumes }}" diff --git a/ansible/roles/ovn/handlers/main.yml b/ansible/roles/ovn-db/handlers/main.yml similarity index 75% rename from ansible/roles/ovn/handlers/main.yml rename to ansible/roles/ovn-db/handlers/main.yml index 94977013f9..8c9c15a356 100644 --- a/ansible/roles/ovn/handlers/main.yml +++ b/ansible/roles/ovn-db/handlers/main.yml @@ -2,7 +2,7 @@ - name: Restart ovn-nb-db container vars: service_name: "ovn-nb-db" - service: "{{ ovn_services[service_name] }}" + service: "{{ ovn_db_services[service_name] }}" become: true kolla_docker: action: "recreate_or_restart_container" @@ -17,7 +17,7 @@ - name: Restart ovn-sb-db container vars: service_name: "ovn-sb-db" - service: "{{ ovn_services[service_name] }}" + service: "{{ ovn_db_services[service_name] }}" become: true kolla_docker: action: "recreate_or_restart_container" @@ -60,22 +60,7 @@ - name: Restart ovn-northd container vars: service_name: "ovn-northd" - service: "{{ ovn_services[service_name] }}" - become: true - kolla_docker: - action: "recreate_or_restart_container" - common_options: "{{ docker_common_options }}" - name: "{{ service.container_name }}" - image: "{{ service.image }}" - volumes: "{{ service.volumes | reject('equalto', '') | list }}" - dimensions: "{{ service.dimensions }}" - when: - - kolla_action != "config" - -- name: Restart ovn-controller container - vars: - service_name: "ovn-controller" - service: "{{ ovn_services[service_name] }}" + service: "{{ ovn_db_services[service_name] }}" become: true kolla_docker: action: "recreate_or_restart_container" diff --git a/ansible/roles/ovn/tasks/check-containers.yml b/ansible/roles/ovn-db/tasks/check-containers.yml similarity index 92% rename from ansible/roles/ovn/tasks/check-containers.yml rename to ansible/roles/ovn-db/tasks/check-containers.yml index c08cec2850..5527b7d080 100644 --- a/ansible/roles/ovn/tasks/check-containers.yml +++ b/ansible/roles/ovn-db/tasks/check-containers.yml @@ -11,6 +11,6 @@ when: - inventory_hostname in groups[item.value.group] - item.value.enabled | bool - with_dict: "{{ ovn_services }}" + with_dict: "{{ ovn_db_services }}" notify: - Restart {{ item.key }} container diff --git a/ansible/roles/ovn/tasks/config.yml b/ansible/roles/ovn-db/tasks/config.yml similarity index 90% rename from ansible/roles/ovn/tasks/config.yml rename to ansible/roles/ovn-db/tasks/config.yml index 4731d581d0..5046bd1041 100644 --- a/ansible/roles/ovn/tasks/config.yml +++ b/ansible/roles/ovn-db/tasks/config.yml @@ -10,7 +10,7 @@ when: - inventory_hostname in groups[item.value.group] - item.value.enabled | bool - with_dict: "{{ ovn_services }}" + with_dict: "{{ ovn_db_services }}" - name: Copying over config.json files for services template: @@ -21,6 +21,6 @@ when: - inventory_hostname in groups[item.value.group] - item.value.enabled | bool - with_dict: "{{ ovn_services }}" + with_dict: "{{ ovn_db_services }}" notify: - Restart {{ item.key }} container diff --git a/ansible/roles/ovn-db/tasks/deploy-containers.yml b/ansible/roles/ovn-db/tasks/deploy-containers.yml new file mode 100644 index 0000000000..eb24ab5c7a --- /dev/null +++ b/ansible/roles/ovn-db/tasks/deploy-containers.yml @@ -0,0 +1,2 @@ +--- +- import_tasks: check-containers.yml diff --git a/ansible/roles/ovn/tasks/upgrade.yml b/ansible/roles/ovn-db/tasks/deploy.yml similarity index 100% rename from ansible/roles/ovn/tasks/upgrade.yml rename to ansible/roles/ovn-db/tasks/deploy.yml diff --git a/ansible/roles/ovn-db/tasks/main.yml b/ansible/roles/ovn-db/tasks/main.yml new file mode 100644 index 0000000000..bc5d1e6257 --- /dev/null +++ b/ansible/roles/ovn-db/tasks/main.yml @@ -0,0 +1,2 @@ +--- +- include_tasks: "{{ kolla_action }}.yml" diff --git a/ansible/roles/ovn/tasks/precheck.yml b/ansible/roles/ovn-db/tasks/precheck.yml similarity index 100% rename from ansible/roles/ovn/tasks/precheck.yml rename to ansible/roles/ovn-db/tasks/precheck.yml diff --git a/ansible/roles/ovn-db/tasks/pull.yml b/ansible/roles/ovn-db/tasks/pull.yml new file mode 100644 index 0000000000..53f9c5fda1 --- /dev/null +++ b/ansible/roles/ovn-db/tasks/pull.yml @@ -0,0 +1,3 @@ +--- +- import_role: + role: service-images-pull diff --git a/ansible/roles/ovn-db/tasks/reconfigure.yml b/ansible/roles/ovn-db/tasks/reconfigure.yml new file mode 100644 index 0000000000..5b10a7e111 --- /dev/null +++ b/ansible/roles/ovn-db/tasks/reconfigure.yml @@ -0,0 +1,2 @@ +--- +- import_tasks: deploy.yml diff --git a/ansible/roles/ovn/tasks/stop.yml b/ansible/roles/ovn-db/tasks/stop.yml similarity index 65% rename from ansible/roles/ovn/tasks/stop.yml rename to ansible/roles/ovn-db/tasks/stop.yml index 885576f7de..eadbf02a80 100644 --- a/ansible/roles/ovn/tasks/stop.yml +++ b/ansible/roles/ovn-db/tasks/stop.yml @@ -2,5 +2,5 @@ - import_role: role: service-stop vars: - project_services: "{{ ovn_services }}" + project_services: "{{ ovn_db_services }}" service_name: "{{ project_name }}" diff --git a/ansible/roles/ovn-db/tasks/upgrade.yml b/ansible/roles/ovn-db/tasks/upgrade.yml new file mode 100644 index 0000000000..5b10a7e111 --- /dev/null +++ b/ansible/roles/ovn-db/tasks/upgrade.yml @@ -0,0 +1,2 @@ +--- +- import_tasks: deploy.yml diff --git a/ansible/roles/ovn/templates/ovn-nb-db.json.j2 b/ansible/roles/ovn-db/templates/ovn-nb-db.json.j2 similarity index 100% rename from ansible/roles/ovn/templates/ovn-nb-db.json.j2 rename to ansible/roles/ovn-db/templates/ovn-nb-db.json.j2 diff --git a/ansible/roles/ovn/templates/ovn-northd.json.j2 b/ansible/roles/ovn-db/templates/ovn-northd.json.j2 similarity index 100% rename from ansible/roles/ovn/templates/ovn-northd.json.j2 rename to ansible/roles/ovn-db/templates/ovn-northd.json.j2 diff --git a/ansible/roles/ovn/templates/ovn-sb-db.json.j2 b/ansible/roles/ovn-db/templates/ovn-sb-db.json.j2 similarity index 100% rename from ansible/roles/ovn/templates/ovn-sb-db.json.j2 rename to ansible/roles/ovn-db/templates/ovn-sb-db.json.j2 diff --git a/ansible/roles/ovn-db/vars/main.yml b/ansible/roles/ovn-db/vars/main.yml new file mode 100644 index 0000000000..485229e938 --- /dev/null +++ b/ansible/roles/ovn-db/vars/main.yml @@ -0,0 +1,6 @@ +--- +project_name: "ovn" + +# NOTE(mnasiadka): we need this for the ovn-db role because this role's +# vars prefix does not match "{{ project_name }}" +kolla_role_name: "ovn_db" diff --git a/ansible/roles/ovn/vars/main.yml b/ansible/roles/ovn/vars/main.yml deleted file mode 100644 index c1f916170b..0000000000 --- a/ansible/roles/ovn/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -project_name: "ovn" diff --git a/ansible/site.yml b/ansible/site.yml index cdf9c0785c..0b4a7f20fa 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -651,18 +651,27 @@ tags: ovs-dpdk, when: "(enable_openvswitch | bool) and (enable_ovs_dpdk | bool)"} -- name: Apply role ovn +- name: Apply role ovn-db gather_facts: false hosts: - - ovn-controller - ovn-nb-db - ovn-northd - ovn-sb-db - '&enable_ovn_True' serial: '{{ kolla_serial|default("0") }}' roles: - - { role: ovn, - tags: ovn } + - { role: ovn-db, + tags: [ovn, ovn-db] } + +- name: Apply role ovn-controller + gather_facts: false + hosts: + - ovn-controller + - '&enable_ovn_True' + serial: '{{ kolla_serial|default("0") }}' + roles: + - { role: ovn-controller, + tags: [ovn, ovn-controller] } - name: Apply role neutron gather_facts: false diff --git a/releasenotes/notes/ovn-controller-ecb49695dc377e88.yaml b/releasenotes/notes/ovn-controller-ecb49695dc377e88.yaml new file mode 100644 index 0000000000..176993f1fa --- /dev/null +++ b/releasenotes/notes/ovn-controller-ecb49695dc377e88.yaml @@ -0,0 +1,7 @@ +--- +upgrade: + - | + ``ovn`` role has been split into ``ovn-controller`` and ``ovn-db`` + roles, therefore users that have ``ovn_extra_volumes`` configured + need to adapt their config to use ``ovn_db_extra_volumes`` or + ``ovn_controller_extra_volumes``. diff --git a/zuul.d/base.yaml b/zuul.d/base.yaml index 52660692f5..6d5d5f1d56 100644 --- a/zuul.d/base.yaml +++ b/zuul.d/base.yaml @@ -196,7 +196,7 @@ parent: kolla-ansible-base voting: false files: - - ^ansible/roles/(neutron|octavia|openvswitch|ovn)/ + - ^ansible/roles/(neutron|octavia|openvswitch|ovn-controller|ovn-db)/ - ^tests/test-ovn.sh - ^tests/test-core-openstack.sh vars: