diff --git a/deployment/ovn/ovn-controller-container-puppet.yaml b/deployment/ovn/ovn-controller-container-puppet.yaml index 30eabc3ef3..cc911d0a24 100644 --- a/deployment/ovn/ovn-controller-container-puppet.yaml +++ b/deployment/ovn/ovn-controller-container-puppet.yaml @@ -444,3 +444,47 @@ outputs: ovn_bridge_mappings: {get_attr: [OVNBridgeMappingsValue, value, ovn_bridge_mappings]} ovn_static_bridge_mac_mappings: {get_attr: [OVNBridgeMappingsValue, value, ovn_static_bridge_mac_mappings]} upgrade_tasks: [] + scale_tasks: + - when: + - step|int == 1 + - container_cli == 'podman' + tags: down + environment: + OS_CLOUD: {get_param: RootStackName} + block: + # Some tasks are running from the Undercloud which has + # the OpenStack clients installed. + - name: Get neutron agents ID + command: openstack network agent list --column ID --column Host --column Binary --format yaml + register: neutron_agents_result + delegate_to: "{{ groups['Undercloud'] | first }}" + check_mode: false + changed_when: false + - name: Filter only current host + set_fact: + neutron_agents: "{{ neutron_agents_result.stdout | from_yaml | selectattr('Host', 'match', ansible_facts['fqdn'] ~ '.*') | list }}" + delegate_to: "{{ groups['Undercloud'] | first }}" + check_mode: false + - name: Deleting OVN agents + block: + - name: Stop OVN containers + loop: + - tripleo_ovn_controller + - tripleo_ovn_metadata_agent + service: + name: "{{ item }}" + state: stopped + enabled: false + become: true + register: stop_containers + failed_when: "('msg' in stop_containers and + 'Could not find the requested service' not in stop_containers.msg) or + ('rc' in stop_containers and stop_containers.rc != 0)" + - name: Delete neutron agents + loop: "{{ neutron_agents }}" + loop_control: + loop_var: agent + label: "{{ agent.Host }}/{{ agent.Binary }}" + command: openstack network agent delete {{ agent.ID }} + delegate_to: "{{ groups['Undercloud'] | first }}" + check_mode: false