Merge "migration: Remove crudini when migrating tunnels"

This commit is contained in:
Zuul 2021-03-29 13:50:46 +00:00 committed by Gerrit Code Review
commit 889608e01f
2 changed files with 12 additions and 4 deletions
tools/ovn_migration/tripleo_environment/playbooks/roles/prepare-controllers
defaults
tasks

@ -1,2 +1,3 @@
---
neutron_conf_path: /var/lib/config-data/puppet-generated/neutron/etc/neutron/neutron.conf
neutron_conf_tempfile: /tmp/neutron.conf

@ -1,8 +1,15 @@
---
- name: Get DB connection string
command: crudini --get {{ neutron_conf_path }} database connection
- 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
register: mysql_url
# The shell below is not readable well. The code spawns a sqlalchemy engine
# and connects to the Neutron database to run following SQL command:
@ -16,5 +23,5 @@
# 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("{{ mysql_url.stdout }}")\nwith engine.connect() as conn:\n\tconn.execute("update networksegments set networksegments.network_type=\'geneve\' where networksegments.network_type=\'vxlan\';")'
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