From ec04972b728b0b78717c9d18988eda06b61ebe77 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Nasiadka?= <mnasiadka@gmail.com>
Date: Tue, 16 Feb 2021 17:29:01 +0100
Subject: [PATCH] ovn: Fix disabling of gateway chassis

It currently runs on hosts in ovn group, and in case that controllers are not
network gateways - it fails on missing openvswitch.

Change-Id: Ibbf683872337402b4e2a38323bb6a3f35ee4bed4
---
 ansible/roles/ovn/tasks/bootstrap.yml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ansible/roles/ovn/tasks/bootstrap.yml b/ansible/roles/ovn/tasks/bootstrap.yml
index e89adc2400..d43e7affba 100644
--- a/ansible/roles/ovn/tasks/bootstrap.yml
+++ b/ansible/roles/ovn/tasks/bootstrap.yml
@@ -32,7 +32,9 @@
 - name: Ensure chassis as gateway is disabled where required
   become: true
   command: docker exec openvswitch_vswitchd ovs-vsctl remove Open_vSwitch . external-ids ovn-cms-options
-  when: inventory_hostname not in groups["ovn-controller-network"]
+  when:
+    - inventory_hostname in groups["openvswitch"]
+    - inventory_hostname not in groups["ovn-controller-network"]
 
 - name: Set OVN remote probe interval
   become: true