From 0c13df58ebfe1ad6691d5764084093ea67b6958b Mon Sep 17 00:00:00 2001
From: Aleksandr Kurbatov <aleksandr.kurbatov@GL1342.local>
Date: Wed, 22 May 2024 18:00:12 +0100
Subject: [PATCH] deploy_base_config: style update

---
 .../base_config/tasks/deploy_base_config.yaml | 39 ++++++++++++-------
 1 file changed, 26 insertions(+), 13 deletions(-)

diff --git a/geant/gap_ansible/roles/base_config/tasks/deploy_base_config.yaml b/geant/gap_ansible/roles/base_config/tasks/deploy_base_config.yaml
index cbd919bf..ce174aec 100644
--- a/geant/gap_ansible/roles/base_config/tasks/deploy_base_config.yaml
+++ b/geant/gap_ansible/roles/base_config/tasks/deploy_base_config.yaml
@@ -7,8 +7,10 @@
   diff: true
   register: output
   when: >
-    verb == "deploy" and
-    ( dry_run | ansible.builtin.bool ) is true and
+    verb == "deploy"
+    and
+    ( dry_run | ansible.builtin.bool )
+    and
     wfo_router.router.vendor == "juniper"
 
 
@@ -20,8 +22,10 @@
     comment: "{{ commit_comment }}"
   diff: true
   when: >
-    verb == "deploy" and
-    ( dry_run | ansible.builtin.bool ) is false and
+    verb == "deploy"
+    and
+    not ( dry_run | ansible.builtin.bool )
+    and
     wfo_router.router.vendor == "juniper"
 
 - name: Deploy base_config on "{{ inventory_hostname }}" [CHECK ONLY][NOKIA]
@@ -36,11 +40,14 @@
   register: output
   check_mode: true
   when: >
-    verb == "deploy" and
-    ( dry_run | ansible.builtin.bool ) is true and
+    verb == "deploy"
+    and
+    ( dry_run | ansible.builtin.bool )
+    and
     wfo_router.router.vendor == "nokia"
 
-- name: Fail if there is any diff 
+
+- name: Fail if there is any diff
   ansible.builtin.fail:
     msg: There are diffs!!!!
   when: >
@@ -53,8 +60,10 @@
   ansible.builtin.debug:
     msg: "Base config has been validated against the router and no syntax errors were found"
   when: >
-    verb == "deploy" and
-    ( dry_run | ansible.builtin.bool ) is true and
+    verb == "deploy"
+    and
+    ( dry_run | ansible.builtin.bool )
+    and
     wfo_router.router.vendor == "nokia"
 
 
@@ -69,14 +78,18 @@
   diff: true
   check_mode: false
   when: >
-    verb == "deploy" and
-    ( dry_run | ansible.builtin.bool ) is false and
+    verb == "deploy"
+    and
+    not ( dry_run | ansible.builtin.bool )
+    and
     wfo_router.router.vendor == "nokia"
 
 - name: PLEASE CHECK THE CONFIG ON THE BOX
   ansible.builtin.debug:
     msg: "Base config has been deployed, check on the router for the result"
   when: >
-    verb == "deploy" and
-    ( dry_run | ansible.builtin.bool ) is false and
+    verb == "deploy"
+    and
+    not ( dry_run | ansible.builtin.bool )
+    and
     wfo_router.router.vendor == "nokia"
-- 
GitLab