From ce7dfd1f5192b6e47ff5013c74d1468cd7eef921 Mon Sep 17 00:00:00 2001
From: Aleksandr Kurbatov <aleksandr.kurbatov@GL1342.local>
Date: Thu, 7 Mar 2024 15:24:44 +0000
Subject: [PATCH] main: general cleanup

---
 .../roles/iptrunk_migration/tasks/main.yml    | 29 ++++++-------------
 1 file changed, 9 insertions(+), 20 deletions(-)

diff --git a/geant/gap_ansible/roles/iptrunk_migration/tasks/main.yml b/geant/gap_ansible/roles/iptrunk_migration/tasks/main.yml
index bdcbc44c..6de46b5a 100644
--- a/geant/gap_ansible/roles/iptrunk_migration/tasks/main.yml
+++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/main.yml
@@ -21,14 +21,6 @@
     opid: "{{ lookup('community.general.random_string', length=18, special=false) }}"
     config_is_different: "False"
 
-- name: Lets take a look at trunk
-  ansible.builtin.debug:
-    msg: "{{ wfo_trunk }}"
-
-      # - name: Lets take a look at trunk
-      #   ansible.builtin.debug:
-      #     msg: "{{ trunks[0] }}"
-
 - name: The old node is
   ansible.builtin.debug:
     msg: "{{ old_node }}"
@@ -62,26 +54,23 @@
   ansible.builtin.debug:
     msg: "{{ opid }}"
 
-- name: Include compiling the template
+- name: Include compiling the template for the old node
   ansible.builtin.include_tasks: compile_template.yaml
-  when: verb == "deactivate" and inventory_hostname == old_node
-
-- name: Include compiling the template
-  ansible.builtin.include_tasks: compile_template.yaml
-  when: verb == "delete" and inventory_hostname == old_node
+  when: (verb == "deactivate" or verb == "delete")
+        and inventory_hostname == old_node
 
-- name: Include compiling the template
-  ansible.builtin.include_tasks: compile_template.yaml
-  when: verb == "deploy" and inventory_hostname == new_node.router.router_fqdn
-
-- name: Include the modification tasks if specified
+- name: Include deactivation tasks for the old node
   ansible.builtin.include_tasks: deactivate_trunk_side.yaml
   when: verb == "deactivate" and inventory_hostname == old_node
 
-- name: Include the removal tasks if specified
+- name: Include removal tasks for the old node
   ansible.builtin.include_tasks: delete_trunk_side.yaml
   when: verb == "delete" and inventory_hostname == old_node
 
+- name: Include compiling the template for the new node
+  ansible.builtin.include_tasks: compile_template.yaml
+  when: verb == "deploy" and inventory_hostname == new_node.router.router_fqdn
+
 - name: Include the deployment tasks if specified
   ansible.builtin.include_tasks: deploy_object.yaml
   when: verb == "deploy" and inventory_hostname == new_node.router.router_fqdn
-- 
GitLab