Browse Source

Add different logic when running against the Undercloud or the Controller

The 'neutron-sanity-check role could be executed against the UC but also
against the Controller nodes. However, the 'container_cli' variable comes
from two different sources of information. This roles should manage this.

OVN is now the default ML2 plugin for the OC nodes while the UC is still
using OVS. Then, this role has to run the 'neutron-sanity-check' command
on two different containers as well:
  - Undercloud -> neutron_ovs_agent
  - Controller -> neutron_api

This patches fixes both of these issues.

Change-Id: I3a027282243db1645361e987cc63f7b6f6fc78ce
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
tags/11.2.0^0
Gael Chamoulaud 3 months ago
parent
commit
8657467d74
1 changed files with 27 additions and 13 deletions
  1. 27
    13
      roles/neutron-sanity-check/tasks/main.yml

+ 27
- 13
roles/neutron-sanity-check/tasks/main.yml View File

@@ -1,21 +1,35 @@
1 1
 ---
2
-- name: Get the path of tripleo undercloud config file
3
-  become: true
4
-  hiera: name="tripleo_undercloud_conf_file"
2
+- name: Set oc_container_cli and container_name for the Controller
3
+  set_fact:
4
+    oc_container_cli: "{{ hostvars[inventory_hostname].container_cli | default('podman', true) }}"
5
+    container_name: "neutron_api"
6
+  when: "'Controller' in group_names"
5 7
 
6
-- name: Get the Container CLI from the undercloud.conf file
7
-  become: true
8
-  ini:
9
-    path: "{{ tripleo_undercloud_conf_file }}"
10
-    section: DEFAULT
11
-    key: container_cli
12
-    ignore_missing_file: true
13
-  register: container_cli
8
+- when: "'Undercloud' in group_names"
9
+  block:
10
+  - name: Get the path of tripleo undercloud config file
11
+    become: true
12
+    hiera:
13
+      name: "tripleo_undercloud_conf_file"
14
+
15
+  - name: Get the Container CLI from the undercloud.conf file
16
+    become: true
17
+    ini:
18
+      path: "{{ tripleo_undercloud_conf_file }}"
19
+      section: DEFAULT
20
+      key: container_cli
21
+      ignore_missing_file: true
22
+    register: container_cli
23
+
24
+  - name: Set uc_container_cli and container_name for the Undercloud
25
+    set_fact:
26
+      uc_container_cli: "{{ container_cli.value|default('podman', true) }}"
27
+      container_name: "neutron_ovs_agent"
14 28
 
15 29
 - name: Run neutron-sanity-check
16 30
   command: >
17
-    {{ container_cli.value|default('podman', true) }}
18
-    exec -u root neutron_ovs_agent
31
+    {% if oc_container_cli is defined %}{{ oc_container_cli }}{% else %}{{ uc_container_cli }}{% endif %}
32
+    exec -u root {{ container_name }}
19 33
     /bin/bash -c 'neutron-sanity-check --config-file {{ item }}'
20 34
   with_items: "{{ configs }}"
21 35
   become: true

Loading…
Cancel
Save