|
| 1 | +--- |
| 2 | + |
| 3 | +# This playbook flushes iptables-legacy rules in the neutron_openvswitch_agent |
| 4 | +# container on overcloud hosts. It is intended to be used in scenarios where |
| 5 | +# neutron_openvswitch_agent was updated to a version without iptables-nft. |
| 6 | + |
| 7 | +# NOTE(wszumski): Also had to run a rabbitmq reset after flushing. Potentially |
| 8 | +# we could do a more targetted restart of containers. |
| 9 | + |
| 10 | +- name: Flushes legacy iptables rules on ML2/OVS deployments |
| 11 | + hosts: overcloud |
| 12 | + gather_facts: false |
| 13 | + become: true |
| 14 | + tasks: |
| 15 | + - name: Gather service facts |
| 16 | + ansible.builtin.service_facts: |
| 17 | + |
| 18 | + - name: End play for hosts without openvswitch agent |
| 19 | + ansible.builtin.meta: end_host |
| 20 | + when: "'kolla-neutron_openvswitch_agent-container.service' not in ansible_facts.services" |
| 21 | + |
| 22 | + - name: Check if neutron legacy iptables rules exist |
| 23 | + ansible.builtin.shell: | |
| 24 | + set -euo pipefail |
| 25 | + {{ container_engine }} exec -u root neutron_openvswitch_agent iptables-legacy-save | grep neutron |
| 26 | + register: save_result |
| 27 | + failed_when: false |
| 28 | + args: |
| 29 | + executable: /bin/bash |
| 30 | + |
| 31 | + - name: End play for hosts where legacy-iptables is not in use by neutron |
| 32 | + ansible.builtin.meta: end_host |
| 33 | + when: save_result.rc != 0 |
| 34 | + |
| 35 | + - name: Flush iptables-legacy in neutron_openvswitch_agent container |
| 36 | + ansible.builtin.shell: | |
| 37 | + set -euo pipefail |
| 38 | + {{ container_engine }} exec -u root neutron_openvswitch_agent iptables-legacy -P INPUT ACCEPT |
| 39 | + {{ container_engine }} exec -u root neutron_openvswitch_agent iptables-legacy -P FORWARD ACCEPT |
| 40 | + {{ container_engine }} exec -u root neutron_openvswitch_agent iptables-legacy -P OUTPUT ACCEPT |
| 41 | + {{ container_engine }} exec -u root neutron_openvswitch_agent iptables-legacy -t nat -F |
| 42 | + {{ container_engine }} exec -u root neutron_openvswitch_agent iptables-legacy -t nat -X |
| 43 | + {{ container_engine }} exec -u root neutron_openvswitch_agent iptables-legacy -t mangle -F |
| 44 | + {{ container_engine }} exec -u root neutron_openvswitch_agent iptables-legacy -t mangle -X |
| 45 | + {{ container_engine }} exec -u root neutron_openvswitch_agent iptables-legacy -t raw -F |
| 46 | + {{ container_engine }} exec -u root neutron_openvswitch_agent iptables-legacy -t raw -X |
| 47 | + {{ container_engine }} exec -u root neutron_openvswitch_agent iptables-legacy -t filter -F |
| 48 | + {{ container_engine }} exec -u root neutron_openvswitch_agent iptables-legacy -t filter -X |
| 49 | + {{ container_engine }} exec -u root neutron_openvswitch_agent iptables-legacy -F |
| 50 | + {{ container_engine }} exec -u root neutron_openvswitch_agent iptables-legacy -X |
| 51 | + args: |
| 52 | + executable: /bin/bash |
0 commit comments