From 3603f9ed37f9f7590597cb394374b6431ffd04cd Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 14:25:56 +0100 Subject: [PATCH] `iptrunk_twamp` - update to use updated storage path --- .../roles/iptrunk_twamp/tasks/compile_object.yaml | 6 +++--- .../iptrunk_twamp/tasks/configure_storage.yaml | 1 + .../roles/iptrunk_twamp/tasks/deploy_object.yaml | 4 ++-- .../gap_ansible/roles/iptrunk_twamp/tasks/main.yml | 14 ++++++-------- 4 files changed, 12 insertions(+), 13 deletions(-) create mode 120000 geant/gap_ansible/roles/iptrunk_twamp/tasks/configure_storage.yaml diff --git a/geant/gap_ansible/roles/iptrunk_twamp/tasks/compile_object.yaml b/geant/gap_ansible/roles/iptrunk_twamp/tasks/compile_object.yaml index f421942c..dccffc09 100644 --- a/geant/gap_ansible/roles/iptrunk_twamp/tasks/compile_object.yaml +++ b/geant/gap_ansible/roles/iptrunk_twamp/tasks/compile_object.yaml @@ -7,15 +7,15 @@ - name: Create a folder for all the templates ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" + path: "{{ play_storage_path }}" state: directory mode: '0755' delegate_to: localhost -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" +- name: Print the template in "{{ play_storage_path }}/{{ config_object }}.conf" ansible.builtin.template: src: "{{ local_side.iptrunk_side_node.vendor }}/{{ config_object }}.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + dest: "{{ play_storage_path }}/{{ config_object }}.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/iptrunk_twamp/tasks/configure_storage.yaml b/geant/gap_ansible/roles/iptrunk_twamp/tasks/configure_storage.yaml new file mode 120000 index 00000000..67d67dcb --- /dev/null +++ b/geant/gap_ansible/roles/iptrunk_twamp/tasks/configure_storage.yaml @@ -0,0 +1 @@ +../../../playbooks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/iptrunk_twamp/tasks/deploy_object.yaml b/geant/gap_ansible/roles/iptrunk_twamp/tasks/deploy_object.yaml index b67902ad..4d356fc2 100644 --- a/geant/gap_ansible/roles/iptrunk_twamp/tasks/deploy_object.yaml +++ b/geant/gap_ansible/roles/iptrunk_twamp/tasks/deploy_object.yaml @@ -2,7 +2,7 @@ - name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [CHECK ONLY][JUNIPER] junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: text check_commit: true diff: true @@ -25,7 +25,7 @@ - name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [AND COMMIT][JUNIPER] junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: text comment: "{{ commit_comment }}" diff: true diff --git a/geant/gap_ansible/roles/iptrunk_twamp/tasks/main.yml b/geant/gap_ansible/roles/iptrunk_twamp/tasks/main.yml index be13f472..11aba4de 100644 --- a/geant/gap_ansible/roles/iptrunk_twamp/tasks/main.yml +++ b/geant/gap_ansible/roles/iptrunk_twamp/tasks/main.yml @@ -9,10 +9,12 @@ ansible.builtin.include_vars: dir: /opt/ansible_inventory/group_vars/routers -- name: Set an ID for this run - ansible.builtin.set_fact: - opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" - config_is_different: "False" +- name: Include configure storage tasks + ansible.builtin.include_tasks: configure_storage.yaml + +# - name: Set "config_is_different" var +# ansible.builtin.set_fact: +# config_is_different: "False" - name: Load local info ansible.builtin.set_fact: @@ -38,10 +40,6 @@ when: ( local_side.iptrunk_side_node.router_access_via_ts | ansible.builtin.bool ) -- name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" - - name: Set short router names for local and remote sides ansible.builtin.set_fact: local_side_short_name: '{{ local_side.iptrunk_side_node.router_fqdn | replace(domain_name_regex, "") }}' -- GitLab