From e4af0c03d2b649d9671fbafb9aae2fd0515e73ca Mon Sep 17 00:00:00 2001
From: Seena Fallah <seenafallah@gmail.com>
Date: Mon, 6 Dec 2021 19:17:45 +0330
Subject: [PATCH] ovn: configure ovn in ovsdb only on ovn-controller hosts

Based on some variables like tunnel_interface_address that are not present in nodes without ovn-controller like controller nodes this task will be failed because of undefined variable

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
Change-Id: Ic511bf6479438f9288a008afb2aae43083a4e69f
Closes-Bug: #1953367
---
 ansible/roles/ovn/tasks/bootstrap.yml                | 1 +
 releasenotes/notes/bug-1953367-61591a7f3ecf28ce.yaml | 7 +++++++
 2 files changed, 8 insertions(+)
 create mode 100644 releasenotes/notes/bug-1953367-61591a7f3ecf28ce.yaml

diff --git a/ansible/roles/ovn/tasks/bootstrap.yml b/ansible/roles/ovn/tasks/bootstrap.yml
index 68d57d796e..728ef1a1e6 100644
--- a/ansible/roles/ovn/tasks/bootstrap.yml
+++ b/ansible/roles/ovn/tasks/bootstrap.yml
@@ -33,3 +33,4 @@
     - { name: ovn-bridge-mappings, value: "{{ ovn_mappings }}", state: "{{ 'present' if (inventory_hostname in groups['ovn-controller-network'] or computes_need_external_bridge | bool) else 'absent' }}" }
     - { name: ovn-chassis-mac-mappings, value: "{{ ovn_macs }}", state: "{{ 'present' if inventory_hostname in groups['ovn-controller-compute'] else 'absent' }}" }
     - { name: ovn-cms-options, value: "{{ ovn_cms_opts }}", state: "{{ 'present' if ovn_cms_opts != '' else 'absent' }}" }
+  when: inventory_hostname in groups.get('ovn-controller', [])
diff --git a/releasenotes/notes/bug-1953367-61591a7f3ecf28ce.yaml b/releasenotes/notes/bug-1953367-61591a7f3ecf28ce.yaml
new file mode 100644
index 0000000000..636a8e25be
--- /dev/null
+++ b/releasenotes/notes/bug-1953367-61591a7f3ecf28ce.yaml
@@ -0,0 +1,7 @@
+---
+fixes:
+  - |
+    Only run ``configure ovn in ovsdb`` task on ovn-controller hosts
+    The task will fail on hosts (like controller nodes) without
+    tunnel interface
+    `LP#1953367 <https://bugs.launchpad.net/kolla-ansible/+bug/1953367>`__