neutron/tools/ovn_migration/tripleo_environment/playbooks/roles/prepare-controllers/tasks/main.yml

28 lines
1.2 KiB
YAML

---
- name: Fetch neutron configuration
fetch:
src: "{{ neutron_conf_path }}"
dest: "{{ neutron_conf_tempfile }}"
flat: yes
when: ovn_central is defined
- name: Get DB connection string
set_fact:
db_connection_string: "{{ lookup('ini', 'connection section=database file={{ neutron_conf_tempfile }}') }}"
when: ovn_central is defined
# The shell below is not readable well. The code spawns a sqlalchemy engine
# and connects to the Neutron database to run following SQL command:
# UPDATE networksegments SET networksegments.network_type='geneve' WHERE networksegments.network_type='vxlan';
# The indented Python code looks as follows:
#
# from sqlalchemy import create_engine
#
# engine = create_engine("{{ mysql_url.stdout }}")
# with engine.connect() as conn:
# conn.execute("SQL COMMAND")
#
- name: Change vxlan networks to Geneve
shell: podman exec -it neutron_api python3 -c $'from sqlalchemy import create_engine\nengine = create_engine("{{ db_connection_string }}")\nwith engine.connect() as conn:\n\tconn.execute("update networksegments set networksegments.network_type=\'geneve\' where networksegments.network_type=\'vxlan\';")'
when: ovn_central is defined