From 3effb008c9820eedd9793e419465c9e8c6a62e45 Mon Sep 17 00:00:00 2001
From: kakkotetsu <kakkotetsu@users.noreply.github.com>
Date: Wed, 23 Feb 2022 16:12:18 +0900
Subject: [PATCH] improve validation conditions for MetalLB BGP Peers (#8568)

---
 roles/kubernetes-apps/metallb/tasks/main.yml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/roles/kubernetes-apps/metallb/tasks/main.yml b/roles/kubernetes-apps/metallb/tasks/main.yml
index a874be05a..952275a8d 100644
--- a/roles/kubernetes-apps/metallb/tasks/main.yml
+++ b/roles/kubernetes-apps/metallb/tasks/main.yml
@@ -13,9 +13,10 @@
 
 - name: Kubernetes Apps | Check BGP peers for MetalLB
   fail:
-    msg: "metallb_peers is mandatory when metallb_protocol is bgp"
+    msg: "metallb_peers is mandatory when metallb_protocol is bgp and metallb_speaker_enabled"
   when:
-    - metallb_protocol == 'bgp' and metallb_peers is not defined
+    - metallb_protocol == 'bgp' and metallb_speaker_enabled
+    - metallb_peers is not defined or not metallb_peers
 
 - name: Kubernetes Apps | Check AppArmor status
   command: which apparmor_parser
-- 
GitLab