From b7abfcfcc1c2c8dbb28bce9bd3cb7296b0530b6f Mon Sep 17 00:00:00 2001
From: Aleksandr Kurbatov <ak@geant.org>
Date: Sat, 26 Apr 2025 14:17:50 +0100
Subject: [PATCH] `ibgp_update` - use new storage path

---
 .../gap_ansible/roles/ibgp_update/tasks/compile.yaml  | 11 ++---------
 .../roles/ibgp_update/tasks/configure_storage.yaml    |  1 +
 geant/gap_ansible/roles/ibgp_update/tasks/deploy.yaml |  4 ++--
 geant/gap_ansible/roles/ibgp_update/tasks/main.yml    |  8 +++-----
 4 files changed, 8 insertions(+), 16 deletions(-)
 create mode 120000 geant/gap_ansible/roles/ibgp_update/tasks/configure_storage.yaml

diff --git a/geant/gap_ansible/roles/ibgp_update/tasks/compile.yaml b/geant/gap_ansible/roles/ibgp_update/tasks/compile.yaml
index 538be40b..15fe7419 100644
--- a/geant/gap_ansible/roles/ibgp_update/tasks/compile.yaml
+++ b/geant/gap_ansible/roles/ibgp_update/tasks/compile.yaml
@@ -7,17 +7,10 @@
     ( wfo_router.router.router_access_via_ts | ansible.builtin.bool ) is true
     and inventory_hostname == wfo_router.router.router_fqdn
 
-- name: Create a folder for all the things
-  ansible.builtin.file:
-    path: "/var/tmp/ansible_run_{{ opid }}"
-    state: directory
-    mode: '0755'
-  delegate_to: localhost
-
-- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/{{ verb }}.conf"
+- name: Print the template in "{{ play_storage_path }}/{{ verb }}.conf"
   ansible.builtin.template:
     src: "{{ vendor }}/{{ verb }}.j2"
-    dest: "/var/tmp/ansible_run_{{ opid }}/{{ verb }}.conf"
+    dest: "{{ play_storage_path }}/{{ verb }}.conf"
     lstrip_blocks: true
     trim_blocks: true
     mode: '0755'
diff --git a/geant/gap_ansible/roles/ibgp_update/tasks/configure_storage.yaml b/geant/gap_ansible/roles/ibgp_update/tasks/configure_storage.yaml
new file mode 120000
index 00000000..67d67dcb
--- /dev/null
+++ b/geant/gap_ansible/roles/ibgp_update/tasks/configure_storage.yaml
@@ -0,0 +1 @@
+../../../playbooks/configure_storage.yaml
\ No newline at end of file
diff --git a/geant/gap_ansible/roles/ibgp_update/tasks/deploy.yaml b/geant/gap_ansible/roles/ibgp_update/tasks/deploy.yaml
index 5d60a579..8954f0fe 100644
--- a/geant/gap_ansible/roles/ibgp_update/tasks/deploy.yaml
+++ b/geant/gap_ansible/roles/ibgp_update/tasks/deploy.yaml
@@ -2,7 +2,7 @@
 - name: Update iBGP mesh ["{{ verb }}"] on "{{ inventory_hostname }}" [CHECK ONLY][Juniper]
   junipernetworks.junos.junos_config:
     update: 'replace'
-    src: "/var/tmp/ansible_run_{{ opid }}/{{ verb }}.conf"
+    src: "{{ play_storage_path }}/{{ verb }}.conf"
     src_format: set
     check_commit: true
   diff: true
@@ -13,7 +13,7 @@
 - name: Update iBGP mesh ["{{ verb }}"] on "{{ inventory_hostname }}" [AND COMMIT][Juniper]
   junipernetworks.junos.junos_config:
     update: 'replace'
-    src: "/var/tmp/ansible_run_{{ opid }}/{{ verb }}.conf"
+    src: "{{ play_storage_path }}/{{ verb }}.conf"
     src_format: set
     comment: "{{ commit_comment }}"
   diff: true
diff --git a/geant/gap_ansible/roles/ibgp_update/tasks/main.yml b/geant/gap_ansible/roles/ibgp_update/tasks/main.yml
index b76edb3b..46ab54a6 100644
--- a/geant/gap_ansible/roles/ibgp_update/tasks/main.yml
+++ b/geant/gap_ansible/roles/ibgp_update/tasks/main.yml
@@ -26,14 +26,12 @@
   ansible.builtin.include_vars:
     dir: /opt/ansible_inventory/group_vars/all
 
-- name: Generate an ID for this run
+- name: Set config_is_different var
   ansible.legacy.set_fact:
-    opid: "{{ lookup('community.general.random_string', length=18, special=false) }}"
     config_is_different: "False"
 
-- name: Print the ID
-  ansible.builtin.debug:
-    msg: "{{ opid }}"
+- name: Include configure storage tasks
+  ansible.builtin.include_tasks: configure_storage.yaml
 
 - name: Include list of routers modification tasks
   ansible.builtin.include_tasks: modify_router_list.yaml
-- 
GitLab