From 52daeed390981c7cf014e0d549ae1acac1ddbde0 Mon Sep 17 00:00:00 2001
From: Aleksandr Kurbatov <aleksandr.kurbatov@GL1342.local>
Date: Mon, 22 Apr 2024 12:01:18 +0100
Subject: [PATCH] Fix calculation of Ansible parameters to connect to the nodes

i.e. correctly load
`ansible_connection` and `ansible_network_os` vars
---
 geant/gap_ansible/roles/iptrunk_checks/tasks/main.yml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/geant/gap_ansible/roles/iptrunk_checks/tasks/main.yml b/geant/gap_ansible/roles/iptrunk_checks/tasks/main.yml
index 94f1ebeb..48646bfa 100644
--- a/geant/gap_ansible/roles/iptrunk_checks/tasks/main.yml
+++ b/geant/gap_ansible/roles/iptrunk_checks/tasks/main.yml
@@ -28,15 +28,15 @@
 
 - name: Set ansible_host to terminal server when router is offline
   ansible.builtin.set_fact:
-    ansible_host: "{{ wfo_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_node.router_site.site_ts_address }}"
-    ansible_port: "{{ wfo_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_node.router_ts_port }}"
+    ansible_host: "{{ local_side.iptrunk_side_node.router_site.site_ts_address }}"
+    ansible_port: "{{ local_side.iptrunk_side_node.router_ts_port }}"
   when:
-    ( wfo_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_node.router_access_via_ts | ansible.builtin.bool ) is true
+    ( local_side.iptrunk_side_node.router_access_via_ts | ansible.builtin.bool ) is true
 
 - name: Load netconf connection config
   ansible.builtin.set_fact:
-    ansible_connection: "{{ netconf_access[wfo_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_node.vendor].ansible_connection }}"
-    ansible_network_os: "{{ netconf_access[wfo_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_node.vendor].ansible_network_os }}"
+    ansible_connection: "{{ netconf_access[local_side.iptrunk_side_node.vendor].ansible_connection }}"
+    ansible_network_os: "{{ netconf_access[local_side.iptrunk_side_node.vendor].ansible_network_os }}"
 
 - name: Check ISIS
   ansible.builtin.include_tasks: check_isis.yaml
-- 
GitLab