Browse Source

migration: Use python3 packages when needed

The patch changes names of installed packages by yum module based on
what Python version of interpreter is available on given node.

Closes-bug: #1839834

Change-Id: I5a2409d80ebd19904909bd62fb7c11ae0cbfde30
(cherry picked from commit 985f3805da)
changes/35/677935/1
Jakub Libosvar 1 month ago
parent
commit
c4367485a1
2 changed files with 19 additions and 5 deletions
  1. 12
    4
      migration/infrared/tripleo-ovn-migration/main.yml
  2. 7
    1
      migration/migrate-to-ovn.yml

+ 12
- 4
migration/infrared/tripleo-ovn-migration/main.yml View File

@@ -2,16 +2,24 @@
2 2
 - name: Install migration tool
3 3
   hosts: undercloud
4 4
   become: true
5
+  vars:
6
+    python_major_version: "{{ ansible_facts.python_version.split('.')[0] }}"
5 7
   tasks:
6
-      - name: Install python virtualenv
8
+      - name: Install python 2 virtualenv and networking ovn migration tool
7 9
         yum:
8
-            name: python-virtualenv
10
+            name:
11
+              - python-virtualenv
12
+              - python-networking-ovn-migration-tool
9 13
             state: present
14
+        when: python_major_version | int == 2
10 15
 
11
-      - name: Install python networking ovn migration tool
16
+      - name: Install python 3 virtualenv and networking ovn migration tool
12 17
         yum:
13
-            name: python-networking-ovn-migration-tool
18
+            name:
19
+              - python3-virtualenv
20
+              - python3-networking-ovn-migration-tool
14 21
             state: present
22
+        when: python_major_version | int == 3
15 23
 
16 24
       - name: Set host_key_checking to False in ansible.cfg
17 25
         ini_file:

+ 7
- 1
migration/migrate-to-ovn.yml View File

@@ -94,10 +94,16 @@
94 94
     command: "ovn-sbctl set-connection ptcp:6642:{{ ovn_db_ip }}"
95 95
     when: ovn_central is defined
96 96
     changed_when: False
97
-  - name: Ensure the Neutron ML2 plugin is installed on neutron-api hosts.
97
+  - name: Ensure the Neutron ML2 plugin Python 2 is installed on neutron-api hosts.
98 98
     yum:
99 99
       name: python-networking-ovn
100 100
       state: present
101
+    when: ansible_facts.python_version.split('.')[0] | int == 2
102
+  - name: Ensure the Neutron ML2 plugin Python 3 is installed on neutron-api hosts.
103
+    yum:
104
+      name: python-networking-ovn
105
+      state: present
106
+    when: ansible_facts.python_version.split('.')[0] | int == 3
101 107
   - name: Update Neutron configuration files
102 108
     ini_file: dest={{ item.dest }} section={{ item.section }} option={{ item.option }} value={{ item.value }}
103 109
     with_items:

Loading…
Cancel
Save