From 8e29c450a21bd821acf1538a0263f0ea88619c76 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 14:38:06 +0100 Subject: [PATCH] `iptrunk` - update to use the new storage path --- .../roles/iptrunk/tasks/compile_object.yaml | 11 ++--------- .../roles/iptrunk/tasks/configure_storage.yaml | 1 + .../roles/iptrunk/tasks/deploy_object.yaml | 4 ++-- geant/gap_ansible/roles/iptrunk/tasks/main.yml | 10 ++-------- .../gap_ansible/roles/iptrunk/tasks/modify_trunk.yaml | 4 ++-- .../gap_ansible/roles/iptrunk/tasks/remove_trunk.yaml | 4 ++-- 6 files changed, 11 insertions(+), 23 deletions(-) create mode 120000 geant/gap_ansible/roles/iptrunk/tasks/configure_storage.yaml diff --git a/geant/gap_ansible/roles/iptrunk/tasks/compile_object.yaml b/geant/gap_ansible/roles/iptrunk/tasks/compile_object.yaml index f248c392..6c56467a 100644 --- a/geant/gap_ansible/roles/iptrunk/tasks/compile_object.yaml +++ b/geant/gap_ansible/roles/iptrunk/tasks/compile_object.yaml @@ -5,17 +5,10 @@ when: ( local_side.iptrunk_side_node.router_access_via_ts | ansible.builtin.bool ) is true -- name: Create a folder for all the templates - 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 }}/{{ 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/tasks/configure_storage.yaml b/geant/gap_ansible/roles/iptrunk/tasks/configure_storage.yaml new file mode 120000 index 00000000..67d67dcb --- /dev/null +++ b/geant/gap_ansible/roles/iptrunk/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/tasks/deploy_object.yaml b/geant/gap_ansible/roles/iptrunk/tasks/deploy_object.yaml index acbaade5..81267508 100644 --- a/geant/gap_ansible/roles/iptrunk/tasks/deploy_object.yaml +++ b/geant/gap_ansible/roles/iptrunk/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/tasks/main.yml b/geant/gap_ansible/roles/iptrunk/tasks/main.yml index d7f1c2d5..f3f0860e 100644 --- a/geant/gap_ansible/roles/iptrunk/tasks/main.yml +++ b/geant/gap_ansible/roles/iptrunk/tasks/main.yml @@ -20,10 +20,8 @@ ansible.builtin.include_vars: dir: /opt/ansible_inventory/group_vars/all -- 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: Load local info ansible.builtin.set_fact: @@ -56,10 +54,6 @@ when: ( local_side.iptrunk_side_node.router_access_via_ts | ansible.builtin.bool ) is true -- name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" - - name: Include compiling the template ansible.builtin.include_tasks: compile_object.yaml when: (verb in verbs) diff --git a/geant/gap_ansible/roles/iptrunk/tasks/modify_trunk.yaml b/geant/gap_ansible/roles/iptrunk/tasks/modify_trunk.yaml index f99b0df4..459701f3 100644 --- a/geant/gap_ansible/roles/iptrunk/tasks/modify_trunk.yaml +++ b/geant/gap_ansible/roles/iptrunk/tasks/modify_trunk.yaml @@ -12,7 +12,7 @@ - name: Update ISIS metric [CHECK ONLY] junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/isis_interface.conf" + src: "{{ play_storage_path }}/isis_interface.conf" src_format: text check_commit: true diff: true @@ -21,7 +21,7 @@ - name: Update ISIS metric [FOR REAL] junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/isis_interface.conf" + src: "{{ play_storage_path }}/isis_interface.conf" src_format: text comment: "{{ commit_comment }}" diff: true diff --git a/geant/gap_ansible/roles/iptrunk/tasks/remove_trunk.yaml b/geant/gap_ansible/roles/iptrunk/tasks/remove_trunk.yaml index 271c8efe..075bed9b 100644 --- a/geant/gap_ansible/roles/iptrunk/tasks/remove_trunk.yaml +++ b/geant/gap_ansible/roles/iptrunk/tasks/remove_trunk.yaml @@ -2,7 +2,7 @@ - name: Remove "{{ config_object }}" on "{{ inventory_hostname }}" [CHECK ONLY][JUNIPER] junipernetworks.junos.junos_config: update: 'merge' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: set check_commit: true diff: true @@ -14,7 +14,7 @@ - name: Remove "{{ config_object }}" on "{{ inventory_hostname }}" [AND COMMIT][JUNIPER] junipernetworks.junos.junos_config: update: 'merge' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: set comment: "{{ commit_comment }}" diff: true -- GitLab