From 2aff171dfe2cae9f1485bf8727655ddfd2bd15dd Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 12:46:23 +0100 Subject: [PATCH 01/24] Storage path management in L3-related playbooks --- .../playbooks/configure_storage.yaml | 22 +++++++++++++++++++ .../playbooks/l3_core_service.yaml | 20 ++--------------- .../playbooks/manage_bgp_peers.yaml | 20 ++--------------- geant/gap_ansible/playbooks/manage_sbp.yaml | 20 ++--------------- .../playbooks/validate_prefix_list.yaml | 20 ++--------------- geant/gap_ansible/playbooks/vrf_update.yaml | 20 ++--------------- 6 files changed, 32 insertions(+), 90 deletions(-) create mode 100644 geant/gap_ansible/playbooks/configure_storage.yaml diff --git a/geant/gap_ansible/playbooks/configure_storage.yaml b/geant/gap_ansible/playbooks/configure_storage.yaml new file mode 100644 index 00000000..84bc2f32 --- /dev/null +++ b/geant/gap_ansible/playbooks/configure_storage.yaml @@ -0,0 +1,22 @@ +- name: Generate an ID for this run + ansible.builtin.set_fact: + opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" + +- name: Print the ID + ansible.builtin.debug: + msg: "{{ opid }}" + +- name: Import group_vars/all + ansible.builtin.include_vars: + dir: /opt/ansible_inventory/group_vars/all + +- name: Generate FS path for artifacts storage + ansible.builtin.set_fact: + play_storage_path: "{{ storage_mount_prefix | default('/var/tmp') }}/{{ gso_process_id | default('gso_pid_undefined') }}/ansible_run_{{ opid }}" + +- name: Create a folder for all compiled output + ansible.builtin.file: + path: "{{ play_storage_path }}" + state: directory + mode: '0755' + delegate_to: localhost diff --git a/geant/gap_ansible/playbooks/l3_core_service.yaml b/geant/gap_ansible/playbooks/l3_core_service.yaml index b1ec56b9..ae0166b0 100644 --- a/geant/gap_ansible/playbooks/l3_core_service.yaml +++ b/geant/gap_ansible/playbooks/l3_core_service.yaml @@ -22,24 +22,8 @@ # verb == 'check' # ansible.builtin.meta: end_play - - name: Generate an ID for this run - ansible.builtin.set_fact: - opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" - - - name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" - - - name: Create a folder for all compiled output - ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" - state: directory - mode: '0755' - delegate_to: localhost - - - name: Import group_vars/all - ansible.builtin.include_vars: - dir: /opt/ansible_inventory/group_vars/all + - name: Include storage path configuration + ansible.builtin.include_tasks: configure_storage.yaml - name: Import standard general variables for GEANT L3 Core Services ansible.builtin.include_vars: diff --git a/geant/gap_ansible/playbooks/manage_bgp_peers.yaml b/geant/gap_ansible/playbooks/manage_bgp_peers.yaml index 113fa28b..b5d5aa16 100644 --- a/geant/gap_ansible/playbooks/manage_bgp_peers.yaml +++ b/geant/gap_ansible/playbooks/manage_bgp_peers.yaml @@ -2,24 +2,8 @@ hosts: all gather_facts: false tasks: - - name: Generate an ID for this run - ansible.builtin.set_fact: - opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" - - - name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" - - - name: Create a folder for all compiled output - ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" - state: directory - mode: '0755' - delegate_to: localhost - - - name: Import group_vars/all - ansible.builtin.include_vars: - dir: /opt/ansible_inventory/group_vars/all + - name: Include storage path configuration + ansible.builtin.include_tasks: configure_storage.yaml - name: Import general variables for {{ partner_name | upper }} ansible.builtin.include_vars: diff --git a/geant/gap_ansible/playbooks/manage_sbp.yaml b/geant/gap_ansible/playbooks/manage_sbp.yaml index 75665516..da45e517 100644 --- a/geant/gap_ansible/playbooks/manage_sbp.yaml +++ b/geant/gap_ansible/playbooks/manage_sbp.yaml @@ -2,24 +2,8 @@ hosts: all gather_facts: false tasks: - - name: Generate an ID for this run - ansible.builtin.set_fact: - opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" - - - name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" - - - name: Create a folder for all compiled output - ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" - state: directory - mode: '0755' - delegate_to: localhost - - - name: Import group_vars/all - ansible.builtin.include_vars: - dir: /opt/ansible_inventory/group_vars/all + - name: Include storage path configuration + ansible.builtin.include_tasks: configure_storage.yaml - name: Import standard general variables for GEANT L3 Core Services ansible.builtin.include_vars: diff --git a/geant/gap_ansible/playbooks/validate_prefix_list.yaml b/geant/gap_ansible/playbooks/validate_prefix_list.yaml index 691c055c..833a8ffa 100644 --- a/geant/gap_ansible/playbooks/validate_prefix_list.yaml +++ b/geant/gap_ansible/playbooks/validate_prefix_list.yaml @@ -3,24 +3,8 @@ hosts: all gather_facts: false tasks: - - name: Generate an ID for this run - ansible.builtin.set_fact: - opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" - - - name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" - - - name: Create a folder for all compiled output - ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" - state: directory - mode: '0755' - delegate_to: localhost - - - name: Import group_vars/all - ansible.builtin.include_vars: - dir: /opt/ansible_inventory/group_vars/all + - name: Include storage path configuration + ansible.builtin.include_tasks: configure_storage.yaml - name: Import standard general variables for GEANT L3 Core Services ansible.builtin.include_vars: diff --git a/geant/gap_ansible/playbooks/vrf_update.yaml b/geant/gap_ansible/playbooks/vrf_update.yaml index 17f26833..d8e33ef1 100644 --- a/geant/gap_ansible/playbooks/vrf_update.yaml +++ b/geant/gap_ansible/playbooks/vrf_update.yaml @@ -3,24 +3,8 @@ hosts: all gather_facts: false tasks: - - name: Generate an ID for this run - ansible.builtin.set_fact: - opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" - - - name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" - - - name: Create a folder for all compiled output - ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" - state: directory - mode: '0755' - delegate_to: localhost - - - name: Import group_vars/all - ansible.builtin.include_vars: - dir: /opt/ansible_inventory/group_vars/all + - name: Include storage path configuration + ansible.builtin.include_tasks: configure_storage.yaml - name: Import standard variables for "{{ subscription.product.product_type }}/{{ subscription.vrf.vrf_name | upper }}" ansible.builtin.include_vars: -- GitLab From 7d31dd6fb60470478c82f653ba5d6f7bb7214c86 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 12:47:12 +0100 Subject: [PATCH 02/24] `bgp_config` - updated storage path --- geant/gap_ansible/roles/bgp_config/tasks/compile.yaml | 4 ++-- geant/gap_ansible/roles/bgp_config/tasks/deploy_bgp.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/geant/gap_ansible/roles/bgp_config/tasks/compile.yaml b/geant/gap_ansible/roles/bgp_config/tasks/compile.yaml index 91cdd033..7ecde8bf 100644 --- a/geant/gap_ansible/roles/bgp_config/tasks/compile.yaml +++ b/geant/gap_ansible/roles/bgp_config/tasks/compile.yaml @@ -4,11 +4,11 @@ ansible_host: "localhost" ansible_connection: local -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_bgp.conf" +- name: Print the template in "{{ play_storage_path }}/{{ partner_name }}_bgp.conf" # when: verb in ["deploy"] ansible.builtin.template: src: "{{ vendor }}/{{ verb }}/bgp.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_bgp.conf" + dest: "{{ play_storage_path }}/{{ partner_name }}_bgp.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/bgp_config/tasks/deploy_bgp.yaml b/geant/gap_ansible/roles/bgp_config/tasks/deploy_bgp.yaml index 4353e467..30568a14 100644 --- a/geant/gap_ansible/roles/bgp_config/tasks/deploy_bgp.yaml +++ b/geant/gap_ansible/roles/bgp_config/tasks/deploy_bgp.yaml @@ -19,7 +19,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_bgp.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ partner_name }}_bgp.conf') }}" commit: true validate: true config_mode: private @@ -32,7 +32,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_bgp.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ partner_name }}_bgp.conf') }}" commit: true commit_comment: "{{ commit_comment }}" config_mode: private -- GitLab From eed9beb71c6eed8e807727f4e54b764d0465f05b Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 12:47:42 +0100 Subject: [PATCH 03/24] `deploy_service_config` - updated storage path --- .../tasks/assemble_config.yml | 16 ++++++++-------- .../deploy_service_config/tasks/push_config.yml | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/geant/gap_ansible/roles/deploy_service_config/tasks/assemble_config.yml b/geant/gap_ansible/roles/deploy_service_config/tasks/assemble_config.yml index 83c77e19..e04b2a69 100644 --- a/geant/gap_ansible/roles/deploy_service_config/tasks/assemble_config.yml +++ b/geant/gap_ansible/roles/deploy_service_config/tasks/assemble_config.yml @@ -10,7 +10,7 @@ # Because ansible.builtin.assemble works with a single directory - name: Create a subdirectory for the assembled output ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}/assembled/" + path: "{{ play_storage_path }}/assembled/" state: directory mode: '0755' @@ -18,28 +18,28 @@ - name: Copy Nokia SR OS header for assembly ansible.builtin.copy: src: "{{ vendor }}/header" - dest: "/var/tmp/ansible_run_{{ opid }}/assembled/00_header" + dest: "{{ play_storage_path }}/assembled/00_header" mode: '0644' # Enumeration prefix is needed to impact the order of assembly - name: Copy Nokia SR OS footer for assembly ansible.builtin.copy: src: "{{ vendor }}/footer" - dest: "/var/tmp/ansible_run_{{ opid }}/assembled/02_footer" + dest: "{{ play_storage_path }}/assembled/02_footer" mode: '0644' # Enumeration prefix is needed to impact the order of assembly - name: Assemble body of the config ansible.builtin.assemble: - src: "/var/tmp/ansible_run_{{ opid }}/" - dest: "/var/tmp/ansible_run_{{ opid }}/assembled/01-body" + src: "{{ play_storage_path }}/" + dest: "{{ play_storage_path }}/assembled/01-body" mode: '0644' # Use the enumeration prefixes to assemble fragments in the right order - name: Merge header, body and footer to get the final config ansible.builtin.assemble: - src: "/var/tmp/ansible_run_{{ opid }}/assembled" - dest: "/var/tmp/ansible_run_{{ opid }}/assembled/for_deployment" + src: "{{ play_storage_path }}/assembled" + dest: "{{ play_storage_path }}/assembled/for_deployment" mode: '0644' - name: Clean up the fragments @@ -48,4 +48,4 @@ state: absent mode: '0755' with_fileglob: - - "/var/tmp/ansible_run_{{ opid }}/assembled/0*" + - "{{ play_storage_path }}/assembled/0*" diff --git a/geant/gap_ansible/roles/deploy_service_config/tasks/push_config.yml b/geant/gap_ansible/roles/deploy_service_config/tasks/push_config.yml index 59c2a28b..655885aa 100644 --- a/geant/gap_ansible/roles/deploy_service_config/tasks/push_config.yml +++ b/geant/gap_ansible/roles/deploy_service_config/tasks/push_config.yml @@ -7,7 +7,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/assembled/for_deployment') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/assembled/for_deployment') }}" commit: true validate: true config_mode: private @@ -47,7 +47,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/assembled/for_deployment') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/assembled/for_deployment') }}" commit: true commit_comment: "{{ commit_comment }}" config_mode: private @@ -61,7 +61,7 @@ vendor == "juniper" junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/assembled/for_deployment" + src: "{{ play_storage_path }}/assembled/for_deployment" src_format: set check_commit: true diff: true @@ -73,7 +73,7 @@ vendor == "juniper" junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/assembled/for_deployment" + src: "{{ play_storage_path }}/assembled/for_deployment" src_format: set comment: "{{ commit_comment }}" diff: true -- GitLab From dda22de65f554a7d54e32b180d3cdf8d05013980 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 12:48:10 +0100 Subject: [PATCH 04/24] `fw_filters` - updated storage path --- geant/gap_ansible/roles/fw_filters/tasks/compile.yaml | 4 ++-- geant/gap_ansible/roles/fw_filters/tasks/deploy_fw.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/geant/gap_ansible/roles/fw_filters/tasks/compile.yaml b/geant/gap_ansible/roles/fw_filters/tasks/compile.yaml index 542c04d5..f8ab6589 100644 --- a/geant/gap_ansible/roles/fw_filters/tasks/compile.yaml +++ b/geant/gap_ansible/roles/fw_filters/tasks/compile.yaml @@ -4,11 +4,11 @@ ansible_host: "localhost" ansible_connection: local -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_filters.conf" +- name: Print the template in "{{ play_storage_path }}/{{ partner_name }}_filters.conf" # when: verb in ["deploy", "update", "terminate"] ansible.builtin.template: src: "filters/gen_filters.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_filters.conf" + dest: "{{ play_storage_path }}/{{ partner_name }}_filters.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/fw_filters/tasks/deploy_fw.yaml b/geant/gap_ansible/roles/fw_filters/tasks/deploy_fw.yaml index 1d7d8d4c..fe5e515b 100644 --- a/geant/gap_ansible/roles/fw_filters/tasks/deploy_fw.yaml +++ b/geant/gap_ansible/roles/fw_filters/tasks/deploy_fw.yaml @@ -19,7 +19,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_filters.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ partner_name }}_filters.conf') }}" commit: true validate: true config_mode: private @@ -32,7 +32,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_filters.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ partner_name }}_filters.conf') }}" commit: true commit_comment: "{{ commit_comment }}" config_mode: private -- GitLab From cc1b23058fdca90d30169d567fe66e6ae274f8cb Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 12:48:26 +0100 Subject: [PATCH 05/24] `l2circuits` - udpated storage path --- geant/gap_ansible/roles/l2circuits/tasks/compile.yaml | 4 ++-- geant/gap_ansible/roles/l2circuits/tasks/push_config.yaml | 8 ++++---- .../roles/l2circuits/tasks/standard_tasks.yaml | 6 +++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/geant/gap_ansible/roles/l2circuits/tasks/compile.yaml b/geant/gap_ansible/roles/l2circuits/tasks/compile.yaml index 86f50fbb..87b81c45 100644 --- a/geant/gap_ansible/roles/l2circuits/tasks/compile.yaml +++ b/geant/gap_ansible/roles/l2circuits/tasks/compile.yaml @@ -4,11 +4,11 @@ ansible_host: "localhost" ansible_connection: local -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/{{ l2circuits_fqdn }}_l2c.conf" +- name: Print the template in "{{ play_storage_path }}/{{ l2circuits_fqdn }}_l2c.conf" # when: verb in ["deploy", "update", "terminate"] ansible.builtin.template: src: "{{ l2circuits_vendor }}/{{ verb }}/l2circuit.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/{{ l2circuits_fqdn }}_l2c.conf" + dest: "{{ play_storage_path }}/{{ l2circuits_fqdn }}_l2c.conf" lstrip_blocks: true trim_blocks: true mode: "0755" diff --git a/geant/gap_ansible/roles/l2circuits/tasks/push_config.yaml b/geant/gap_ansible/roles/l2circuits/tasks/push_config.yaml index 3153a8cb..a5f59cc4 100644 --- a/geant/gap_ansible/roles/l2circuits/tasks/push_config.yaml +++ b/geant/gap_ansible/roles/l2circuits/tasks/push_config.yaml @@ -7,7 +7,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ l2circuits_fqdn }}_l2c.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ l2circuits_fqdn }}_l2c.conf') }}" commit: true validate: true config_mode: private @@ -32,7 +32,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ l2circuits_fqdn }}_l2c.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ l2circuits_fqdn }}_l2c.conf') }}" commit: true commit_comment: "{{ commit_comment }}" config_mode: private @@ -46,7 +46,7 @@ l2circuits_vendor == "juniper" junipernetworks.junos.junos_config: update: "replace" - src: "/var/tmp/ansible_run_{{ opid }}/{{ l2circuits_fqdn }}_l2c.conf" + src: "{{ play_storage_path }}/{{ l2circuits_fqdn }}_l2c.conf" src_format: set check_commit: true diff: true @@ -58,7 +58,7 @@ l2circuits_vendor == "juniper" junipernetworks.junos.junos_config: update: "replace" - src: "/var/tmp/ansible_run_{{ opid }}/{{ l2circuits_fqdn }}_l2c.conf" + src: "{{ play_storage_path }}/{{ l2circuits_fqdn }}_l2c.conf" src_format: set comment: "{{ commit_comment }}" diff: true diff --git a/geant/gap_ansible/roles/l2circuits/tasks/standard_tasks.yaml b/geant/gap_ansible/roles/l2circuits/tasks/standard_tasks.yaml index 4772e5bb..359cfd6d 100644 --- a/geant/gap_ansible/roles/l2circuits/tasks/standard_tasks.yaml +++ b/geant/gap_ansible/roles/l2circuits/tasks/standard_tasks.yaml @@ -7,9 +7,13 @@ ansible.builtin.debug: msg: "{{ opid }}" +- name: Generate FS path for artifacts storage + ansible.builtin.set_fact: + play_storage_path: "{{ storage_mount_prefix | default('/var/tmp') }}/{{ gso_process_id | default('gso_pid_undefined') }}/ansible_run_{{ opid }}" + - name: Create a folder for all compiled output ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" + path: "{{ play_storage_path }}" state: directory mode: "0755" delegate_to: localhost -- GitLab From f76a8ded97389ef01d957bd7ae7bb6758fdcb748 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 12:48:42 +0100 Subject: [PATCH 06/24] `pim` - updated storage path --- geant/gap_ansible/roles/pim/tasks/compile.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/geant/gap_ansible/roles/pim/tasks/compile.yaml b/geant/gap_ansible/roles/pim/tasks/compile.yaml index 8bccce4c..770fd798 100644 --- a/geant/gap_ansible/roles/pim/tasks/compile.yaml +++ b/geant/gap_ansible/roles/pim/tasks/compile.yaml @@ -4,11 +4,11 @@ ansible_host: "localhost" ansible_connection: local -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_pim.conf" +- name: Print the template in "{{ play_storage_path }}/{{ partner_name }}_pim.conf" # when: verb in ["deploy", "update", "terminate"] ansible.builtin.template: src: "pim.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_pim.conf" + dest: "{{ play_storage_path }}/{{ partner_name }}_pim.conf" lstrip_blocks: true trim_blocks: true mode: '0755' -- GitLab From 338e394996b2fb77b6df02107e6ddcf577aede07 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 12:49:03 +0100 Subject: [PATCH 07/24] `po_prefix_lists` - updated storage path --- .../roles/po_prefix_lists/tasks/deploy_prefix_lists.yaml | 4 ++-- geant/gap_ansible/roles/po_prefix_lists/tasks/main.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/geant/gap_ansible/roles/po_prefix_lists/tasks/deploy_prefix_lists.yaml b/geant/gap_ansible/roles/po_prefix_lists/tasks/deploy_prefix_lists.yaml index 0062393f..f8d4c231 100644 --- a/geant/gap_ansible/roles/po_prefix_lists/tasks/deploy_prefix_lists.yaml +++ b/geant/gap_ansible/roles/po_prefix_lists/tasks/deploy_prefix_lists.yaml @@ -19,7 +19,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_prefix_lists.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ partner_name }}_prefix_lists.conf') }}" commit: true validate: true config_mode: private @@ -32,7 +32,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_prefix_lists.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ partner_name }}_prefix_lists.conf') }}" commit: true commit_comment: "{{ commit_comment }}" config_mode: private diff --git a/geant/gap_ansible/roles/po_prefix_lists/tasks/main.yml b/geant/gap_ansible/roles/po_prefix_lists/tasks/main.yml index 5b80b08b..1b021390 100644 --- a/geant/gap_ansible/roles/po_prefix_lists/tasks/main.yml +++ b/geant/gap_ansible/roles/po_prefix_lists/tasks/main.yml @@ -140,11 +140,11 @@ nren_prefix_lists: "{{ nren_prefix_lists | default([]) + [{'name': ipv4_prefix_list_name, 'prefixes': bgpq_routes_ipv4}, {'name': ipv6_prefix_list_name, 'prefixes': bgpq_routes_ipv6}] }}" -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_prefix_lists.conf" +- name: Print the template in "{{ play_storage_path }}/{{ partner_name }}_prefix_lists.conf" delegate_to: localhost ansible.builtin.template: src: "nokia/prefix_lists.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_prefix_lists.conf" + dest: "{{ play_storage_path }}/{{ partner_name }}_prefix_lists.conf" lstrip_blocks: true trim_blocks: true mode: '0755' -- GitLab From 3196dc5e4cb6810fe214f5edbac9dd4a21509cea Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 12:49:29 +0100 Subject: [PATCH 08/24] `policy_options` - updated storage path --- geant/gap_ansible/roles/policy_options/tasks/compile.yaml | 4 ++-- geant/gap_ansible/roles/policy_options/tasks/deploy_po.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/geant/gap_ansible/roles/policy_options/tasks/compile.yaml b/geant/gap_ansible/roles/policy_options/tasks/compile.yaml index 81eeb405..c2d08b6c 100644 --- a/geant/gap_ansible/roles/policy_options/tasks/compile.yaml +++ b/geant/gap_ansible/roles/policy_options/tasks/compile.yaml @@ -4,11 +4,11 @@ ansible_host: "localhost" ansible_connection: local -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/PO.conf" +- name: Print the template in "{{ play_storage_path }}/PO.conf" # when: verb in ["deploy", "update", "terminate"] ansible.builtin.template: src: "policy_options.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/PO.conf" + dest: "{{ play_storage_path }}/PO.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/policy_options/tasks/deploy_po.yaml b/geant/gap_ansible/roles/policy_options/tasks/deploy_po.yaml index 70b027de..440a9826 100644 --- a/geant/gap_ansible/roles/policy_options/tasks/deploy_po.yaml +++ b/geant/gap_ansible/roles/policy_options/tasks/deploy_po.yaml @@ -19,7 +19,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_po.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ partner_name }}_po.conf') }}" commit: true validate: true config_mode: private @@ -32,7 +32,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_po.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ partner_name }}_po.conf') }}" commit: true commit_comment: "{{ commit_comment }}" config_mode: private -- GitLab From ff2fe5a31121946760178e692b9062a04a711c84 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 12:49:42 +0100 Subject: [PATCH 09/24] `sbp` - updated storage path --- geant/gap_ansible/roles/sbp/tasks/compile.yaml | 4 ++-- geant/gap_ansible/roles/sbp/tasks/deploy_sbp.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/geant/gap_ansible/roles/sbp/tasks/compile.yaml b/geant/gap_ansible/roles/sbp/tasks/compile.yaml index 839952fe..9608d66d 100644 --- a/geant/gap_ansible/roles/sbp/tasks/compile.yaml +++ b/geant/gap_ansible/roles/sbp/tasks/compile.yaml @@ -4,11 +4,11 @@ ansible_host: "localhost" ansible_connection: local -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_sbp.conf" +- name: Print the template in "{{ play_storage_path }}/{{ partner_name }}_sbp.conf" # when: verb in ["deploy", "update", "terminate"] ansible.builtin.template: src: "{{ vendor }}/{{ verb }}/sbp.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_sbp.conf" + dest: "{{ play_storage_path }}/{{ partner_name }}_sbp.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/sbp/tasks/deploy_sbp.yaml b/geant/gap_ansible/roles/sbp/tasks/deploy_sbp.yaml index 89bdd754..fa45477b 100644 --- a/geant/gap_ansible/roles/sbp/tasks/deploy_sbp.yaml +++ b/geant/gap_ansible/roles/sbp/tasks/deploy_sbp.yaml @@ -19,7 +19,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_sbp.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ partner_name }}_sbp.conf') }}" commit: true validate: true config_mode: private @@ -32,7 +32,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_sbp.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ partner_name }}_sbp.conf') }}" commit: true commit_comment: "{{ commit_comment }}" config_mode: private -- GitLab From 2744088eaa25c99c2841cf22f83d052e3c4bac73 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 12:49:56 +0100 Subject: [PATCH 10/24] `vrf` - updated storage path --- geant/gap_ansible/roles/vrf/tasks/compile.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/geant/gap_ansible/roles/vrf/tasks/compile.yaml b/geant/gap_ansible/roles/vrf/tasks/compile.yaml index 52832206..2458cc3c 100644 --- a/geant/gap_ansible/roles/vrf/tasks/compile.yaml +++ b/geant/gap_ansible/roles/vrf/tasks/compile.yaml @@ -4,11 +4,11 @@ ansible_host: "localhost" ansible_connection: local -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/VRF.conf" +- name: Print the template in "{{ play_storage_path }}/VRF.conf" # when: verb in ["deploy", "update", "terminate"] ansible.builtin.template: src: "service.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/VRF.conf" + dest: "{{ play_storage_path }}/VRF.conf" lstrip_blocks: true trim_blocks: true mode: '0755' -- GitLab From 41b4829fb42f244a5e01df1ac4d60bc1b2dab96c Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 13:08:40 +0100 Subject: [PATCH 11/24] `sdp` role - update storage path --- geant/gap_ansible/roles/sdp/tasks/compile.yaml | 4 ++-- geant/gap_ansible/roles/sdp/tasks/push_config.yaml | 4 ++-- .../gap_ansible/roles/sdp/tasks/standard_tasks.yaml | 12 ++++++++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/geant/gap_ansible/roles/sdp/tasks/compile.yaml b/geant/gap_ansible/roles/sdp/tasks/compile.yaml index 8e128116..665ac32c 100644 --- a/geant/gap_ansible/roles/sdp/tasks/compile.yaml +++ b/geant/gap_ansible/roles/sdp/tasks/compile.yaml @@ -4,10 +4,10 @@ ansible_host: "localhost" ansible_connection: local -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/SDP.conf" +- name: Print the template in "{{ play_storage_path }}/SDP.conf" ansible.builtin.template: src: "routers/nokia/{{ verb }}/sdp.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/SDP.conf" + dest: "{{ play_storage_path }}/SDP.conf" lstrip_blocks: true trim_blocks: true mode: "0755" diff --git a/geant/gap_ansible/roles/sdp/tasks/push_config.yaml b/geant/gap_ansible/roles/sdp/tasks/push_config.yaml index 8ac1c0e9..314cd995 100644 --- a/geant/gap_ansible/roles/sdp/tasks/push_config.yaml +++ b/geant/gap_ansible/roles/sdp/tasks/push_config.yaml @@ -5,7 +5,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/SDP.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/SDP.conf') }}" commit: true validate: true config_mode: private @@ -28,7 +28,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/SDP.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/SDP.conf') }}" commit: true commit_comment: "{{ commit_comment }}" config_mode: private diff --git a/geant/gap_ansible/roles/sdp/tasks/standard_tasks.yaml b/geant/gap_ansible/roles/sdp/tasks/standard_tasks.yaml index 4772e5bb..a575a9ca 100644 --- a/geant/gap_ansible/roles/sdp/tasks/standard_tasks.yaml +++ b/geant/gap_ansible/roles/sdp/tasks/standard_tasks.yaml @@ -7,9 +7,17 @@ ansible.builtin.debug: msg: "{{ opid }}" +- name: Import group_vars/all + ansible.builtin.include_vars: + dir: /opt/ansible_inventory/group_vars/all + +- name: Generate FS path for artifacts storage + ansible.builtin.set_fact: + play_storage_path: "{{ storage_mount_prefix | default('/var/tmp') }}/{{ gso_process_id | default('gso_pid_undefined') }}/ansible_run_{{ opid }}" + - name: Create a folder for all compiled output ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" + path: "{{ play_storage_path }}" state: directory - mode: "0755" + mode: '0755' delegate_to: localhost -- GitLab From d0682be2552a36037ab9a17afb6fa04263fadfab Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 13:12:07 +0100 Subject: [PATCH 12/24] `ip_prefix_lists` - update storage path --- geant/gap_ansible/roles/ip_prefix_lists/tasks/compile.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/geant/gap_ansible/roles/ip_prefix_lists/tasks/compile.yaml b/geant/gap_ansible/roles/ip_prefix_lists/tasks/compile.yaml index f8ce4b6e..50f159a0 100644 --- a/geant/gap_ansible/roles/ip_prefix_lists/tasks/compile.yaml +++ b/geant/gap_ansible/roles/ip_prefix_lists/tasks/compile.yaml @@ -4,12 +4,12 @@ ansible_host: "localhost" ansible_connection: local -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/IP_PREFIX_LISTS.conf" +- name: Print the template in "{{ play_storage_path }}/IP_PREFIX_LISTS.conf" # when: verb in ["deploy", "update", "terminate"] when: final_ip_prefix_lists is defined ansible.builtin.template: src: "ip_prefix_list.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/IP_PREFIX_LISTS.conf" + dest: "{{ play_storage_path }}/IP_PREFIX_LISTS.conf" lstrip_blocks: true trim_blocks: true mode: '0755' -- GitLab From 809163e2e9222e40e25b5bed5b945e8abf9ce281 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 13:23:26 +0100 Subject: [PATCH 13/24] `edge_port` - update storage path --- geant/gap_ansible/roles/edge_port/tasks/compile.yaml | 11 ++--------- .../roles/edge_port/tasks/standard_tasks.yaml | 11 +++++++++++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/geant/gap_ansible/roles/edge_port/tasks/compile.yaml b/geant/gap_ansible/roles/edge_port/tasks/compile.yaml index 6c7fc2c3..0cdaff1a 100644 --- a/geant/gap_ansible/roles/edge_port/tasks/compile.yaml +++ b/geant/gap_ansible/roles/edge_port/tasks/compile.yaml @@ -6,18 +6,11 @@ ansible_host: "localhost" ansible_connection: local -- 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 }}/edge_port_{{ verb }}.conf" +- name: Print the template in "{{ play_storage_path }}/edge_port_{{ verb }}.conf" when: verb == "create" ansible.builtin.template: src: "{{ router.vendor }}/edge_port_{{ verb }}.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/edge_port_{{ verb }}.conf" + dest: "{{ play_storage_path }}/edge_port_{{ verb }}.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/edge_port/tasks/standard_tasks.yaml b/geant/gap_ansible/roles/edge_port/tasks/standard_tasks.yaml index 4642e967..6d29f548 100644 --- a/geant/gap_ansible/roles/edge_port/tasks/standard_tasks.yaml +++ b/geant/gap_ansible/roles/edge_port/tasks/standard_tasks.yaml @@ -35,3 +35,14 @@ - name: Print the ID ansible.builtin.debug: msg: "{{ opid }}" + +- name: Generate FS path for artifacts storage + ansible.builtin.set_fact: + play_storage_path: "{{ storage_mount_prefix | default('/var/tmp') }}/{{ gso_process_id | default('gso_pid_undefined') }}/ansible_run_{{ opid }}" + +- name: Create a folder for all compiled output + ansible.builtin.file: + path: "{{ play_storage_path }}" + state: directory + mode: '0755' + delegate_to: localhost -- GitLab From 9f20023c7847c2ee4397ffa694e4d84d2eb320e3 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 13:40:53 +0100 Subject: [PATCH 14/24] `l2circuits` - include `configure_storage.yaml` tasklist --- .../gap_ansible/roles/l2circuits/tasks/configure_storage.yaml | 1 + geant/gap_ansible/roles/l2circuits/tasks/main.yml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 120000 geant/gap_ansible/roles/l2circuits/tasks/configure_storage.yaml diff --git a/geant/gap_ansible/roles/l2circuits/tasks/configure_storage.yaml b/geant/gap_ansible/roles/l2circuits/tasks/configure_storage.yaml new file mode 120000 index 00000000..67d67dcb --- /dev/null +++ b/geant/gap_ansible/roles/l2circuits/tasks/configure_storage.yaml @@ -0,0 +1 @@ +../../../playbooks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/l2circuits/tasks/main.yml b/geant/gap_ansible/roles/l2circuits/tasks/main.yml index 85f49952..bebc96b9 100644 --- a/geant/gap_ansible/roles/l2circuits/tasks/main.yml +++ b/geant/gap_ansible/roles/l2circuits/tasks/main.yml @@ -7,8 +7,8 @@ - name: Produce the config for the current l2circuit endpoint when: inventory_hostname == l2circuits_fqdn block: - - name: Include standard tasks - ansible.builtin.include_tasks: standard_tasks.yaml + - name: Include configure storage tasks + ansible.builtin.include_tasks: configure_storage.yaml - name: Merge vars ansible.builtin.include_tasks: merge_vars.yaml -- GitLab From 3445e990ea7fc3d2feb8807fe6e651b2266e7d56 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 13:46:47 +0100 Subject: [PATCH 15/24] `edge_port` - use common `configure_storage` tasklist --- .../edge_port/tasks/configure_storage.yaml | 1 + .../roles/edge_port/tasks/main.yml | 3 +++ .../roles/edge_port/tasks/standard_tasks.yaml | 19 ------------------- 3 files changed, 4 insertions(+), 19 deletions(-) create mode 120000 geant/gap_ansible/roles/edge_port/tasks/configure_storage.yaml diff --git a/geant/gap_ansible/roles/edge_port/tasks/configure_storage.yaml b/geant/gap_ansible/roles/edge_port/tasks/configure_storage.yaml new file mode 120000 index 00000000..67d67dcb --- /dev/null +++ b/geant/gap_ansible/roles/edge_port/tasks/configure_storage.yaml @@ -0,0 +1 @@ +../../../playbooks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/edge_port/tasks/main.yml b/geant/gap_ansible/roles/edge_port/tasks/main.yml index 51164357..2381bf69 100644 --- a/geant/gap_ansible/roles/edge_port/tasks/main.yml +++ b/geant/gap_ansible/roles/edge_port/tasks/main.yml @@ -3,6 +3,9 @@ - name: Include Standard role tasks ansible.builtin.include_tasks: standard_tasks.yaml +- name: Include configure storage tasks + ansible.builtin.include_tasks: configure_storage.yaml + - name: Include templates compilation when: verb in verbs ansible.builtin.include_tasks: compile.yaml diff --git a/geant/gap_ansible/roles/edge_port/tasks/standard_tasks.yaml b/geant/gap_ansible/roles/edge_port/tasks/standard_tasks.yaml index 6d29f548..413c0516 100644 --- a/geant/gap_ansible/roles/edge_port/tasks/standard_tasks.yaml +++ b/geant/gap_ansible/roles/edge_port/tasks/standard_tasks.yaml @@ -27,22 +27,3 @@ - name: Import variables for Edge Ports hold times ansible.builtin.include_vars: file: /opt/ansible_inventory/group_vars/routers/nokia/edge_ports.yaml - -- name: Generate an ID for this run - ansible.builtin.set_fact: - opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" - -- name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" - -- name: Generate FS path for artifacts storage - ansible.builtin.set_fact: - play_storage_path: "{{ storage_mount_prefix | default('/var/tmp') }}/{{ gso_process_id | default('gso_pid_undefined') }}/ansible_run_{{ opid }}" - -- name: Create a folder for all compiled output - ansible.builtin.file: - path: "{{ play_storage_path }}" - state: directory - mode: '0755' - delegate_to: localhost -- GitLab From 242cb5a4f7400ae02e485f0f156f61609bae291a Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 14:16:29 +0100 Subject: [PATCH 16/24] updates to `configure_storage` tasklist --- geant/gap_ansible/playbooks/configure_storage.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/geant/gap_ansible/playbooks/configure_storage.yaml b/geant/gap_ansible/playbooks/configure_storage.yaml index 84bc2f32..fe07aa32 100644 --- a/geant/gap_ansible/playbooks/configure_storage.yaml +++ b/geant/gap_ansible/playbooks/configure_storage.yaml @@ -2,10 +2,6 @@ ansible.builtin.set_fact: opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" -- name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" - - name: Import group_vars/all ansible.builtin.include_vars: dir: /opt/ansible_inventory/group_vars/all @@ -20,3 +16,7 @@ state: directory mode: '0755' delegate_to: localhost + +- name: Print storage path for the play + ansible.builtin.debug: + msg: "{{ play_storage_path }}" -- GitLab From 49704d74e6ac9603021e955efed8329a1b304d7c Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 14:16:53 +0100 Subject: [PATCH 17/24] `base_config` - use updated storage path --- .../base_config/tasks/compile_base_config.yaml | 6 +++--- .../roles/base_config/tasks/configure_storage.yaml | 1 + .../roles/base_config/tasks/deploy_base_config.yaml | 4 ++-- geant/gap_ansible/roles/base_config/tasks/main.yml | 13 ++----------- 4 files changed, 8 insertions(+), 16 deletions(-) create mode 120000 geant/gap_ansible/roles/base_config/tasks/configure_storage.yaml diff --git a/geant/gap_ansible/roles/base_config/tasks/compile_base_config.yaml b/geant/gap_ansible/roles/base_config/tasks/compile_base_config.yaml index 96a5b4e2..a0531622 100644 --- a/geant/gap_ansible/roles/base_config/tasks/compile_base_config.yaml +++ b/geant/gap_ansible/roles/base_config/tasks/compile_base_config.yaml @@ -18,15 +18,15 @@ - name: Create a folder for all the things 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 }}/base_config.conf" +- name: Print the template in "{{ play_storage_path }}/base_config.conf" ansible.builtin.template: src: "routers/{{ wfo_router.router.vendor }}/base_config.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/base_config.conf" + dest: "{{ play_storage_path }}/base_config.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/base_config/tasks/configure_storage.yaml b/geant/gap_ansible/roles/base_config/tasks/configure_storage.yaml new file mode 120000 index 00000000..67d67dcb --- /dev/null +++ b/geant/gap_ansible/roles/base_config/tasks/configure_storage.yaml @@ -0,0 +1 @@ +../../../playbooks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/base_config/tasks/deploy_base_config.yaml b/geant/gap_ansible/roles/base_config/tasks/deploy_base_config.yaml index c29a2a04..83d8ab63 100644 --- a/geant/gap_ansible/roles/base_config/tasks/deploy_base_config.yaml +++ b/geant/gap_ansible/roles/base_config/tasks/deploy_base_config.yaml @@ -1,7 +1,7 @@ - name: Deploy base_config on "{{ inventory_hostname }}" [CHECK ONLY][Juniper] junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ mytemplates.template_name }}.conf" + src: "{{ play_storage_path }}/{{ mytemplates.template_name }}.conf" src_format: text check_commit: true diff: true @@ -17,7 +17,7 @@ - name: Deploy base_config on "{{ inventory_hostname }}" [AND COMMIT][Juniper] junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ mytemplates.template_name }}.conf" + src: "{{ play_storage_path }}/{{ mytemplates.template_name }}.conf" src_format: text comment: "{{ commit_comment }}" diff: true diff --git a/geant/gap_ansible/roles/base_config/tasks/main.yml b/geant/gap_ansible/roles/base_config/tasks/main.yml index 0a6fb446..a0f793ae 100644 --- a/geant/gap_ansible/roles/base_config/tasks/main.yml +++ b/geant/gap_ansible/roles/base_config/tasks/main.yml @@ -39,17 +39,8 @@ when: wfo_router.router.vendor == "juniper" - -- name: Generate an ID for this run - ansible.builtin.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: Merge the variables when: verb in verbs -- GitLab 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 18/24] `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 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 19/24] `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 From c338f70126566d45687a7899b1053dab201863f8 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 14:31:08 +0100 Subject: [PATCH 20/24] `promote_p_to_pe` - update to use new storage path --- .../roles/promote_p_to_pe/tasks/compile.yaml | 27 +++++++------------ .../tasks/configure_storage.yaml | 1 + .../roles/promote_p_to_pe/tasks/main.yml | 11 +++----- 3 files changed, 14 insertions(+), 25 deletions(-) create mode 120000 geant/gap_ansible/roles/promote_p_to_pe/tasks/configure_storage.yaml diff --git a/geant/gap_ansible/roles/promote_p_to_pe/tasks/compile.yaml b/geant/gap_ansible/roles/promote_p_to_pe/tasks/compile.yaml index 5303efd3..1ff55455 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/tasks/compile.yaml +++ b/geant/gap_ansible/roles/promote_p_to_pe/tasks/compile.yaml @@ -9,57 +9,50 @@ ansible_host: "localhost" ansible_connection: local -- 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 }}/pe_promotion_base_config.conf" +- name: Print the template in "{{ play_storage_path }}/pe_promotion_base_config.conf" when: verb == "deploy_pe_base_config" ansible.builtin.template: src: "routers/{{ subscription.router.vendor }}/pe_promotion_base_config.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/pe_promotion_base_config.conf" + dest: "{{ play_storage_path }}/pe_promotion_base_config.conf" lstrip_blocks: true trim_blocks: true mode: '0755' delegate_to: localhost -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/pe_promotion_base_vprn.conf" +- name: Print the template in "{{ play_storage_path }}/pe_promotion_base_vprn.conf" when: verb == "deploy_routing_instances" ansible.builtin.template: src: "routers/{{ subscription.router.vendor }}/pe_promotion_base_vprn.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/pe_promotion_base_vprn.conf" + dest: "{{ play_storage_path }}/pe_promotion_base_vprn.conf" lstrip_blocks: true trim_blocks: true mode: '0755' -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/pe_update_sdp.conf" +- name: Print the template in "{{ play_storage_path }}/pe_update_sdp.conf" when: verb == "update_sdp_mesh" ansible.builtin.template: src: "routers/{{ subscription.router.vendor }}/pe_update_sdp.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/pe_update_sdp.conf" + dest: "{{ play_storage_path }}/pe_update_sdp.conf" lstrip_blocks: true trim_blocks: true mode: '0755' delegate_to: localhost -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/delete_default_static_routes.conf" +- name: Print the template in "{{ play_storage_path }}/delete_default_static_routes.conf" when: verb == "delete_default_routes" ansible.builtin.template: src: "routers/{{ subscription.router.vendor }}/router/delete_default_static_routes.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/delete_default_static_routes.conf" + dest: "{{ play_storage_path }}/delete_default_static_routes.conf" lstrip_blocks: true trim_blocks: true mode: '0755' delegate_to: localhost -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/pe_promotion_static_routes.conf" +- name: Print the template in "{{ play_storage_path }}/pe_promotion_static_routes.conf" when: verb == "add_pe_static_routes" ansible.builtin.template: src: "routers/{{ subscription.router.vendor }}/router/pe_promotion_static_routes.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/pe_promotion_static_routes.conf" + dest: "{{ play_storage_path }}/pe_promotion_static_routes.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/promote_p_to_pe/tasks/configure_storage.yaml b/geant/gap_ansible/roles/promote_p_to_pe/tasks/configure_storage.yaml new file mode 120000 index 00000000..67d67dcb --- /dev/null +++ b/geant/gap_ansible/roles/promote_p_to_pe/tasks/configure_storage.yaml @@ -0,0 +1 @@ +../../../playbooks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/promote_p_to_pe/tasks/main.yml b/geant/gap_ansible/roles/promote_p_to_pe/tasks/main.yml index c31c8db5..08e188e5 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/tasks/main.yml +++ b/geant/gap_ansible/roles/promote_p_to_pe/tasks/main.yml @@ -37,18 +37,13 @@ ansible_connection: "{{ netconf_access[subscription.router.vendor].ansible_connection }}" ansible_network_os: "{{ netconf_access[subscription.router.vendor].ansible_network_os }}" -- name: Generate an ID for this run - ansible.builtin.set_fact: - opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" - -- name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" -# # - name: Include ISIS overload tasks # when: verb in ['set_isis_overload', 'remove_isis_overload'] # ansible.builtin.include_tasks: configure_isis_overload.yaml +- name: Include configure storage tasks + ansible.builtin.include_tasks: configure_storage.yaml + - name: Include templates compilation when: verb in [ 'deploy_pe_base_config', 'update_sdp_mesh', 'deploy_routing_instances', 'delete_default_routes', 'add_pe_static_routes' ] ansible.builtin.include_tasks: compile.yaml -- GitLab 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 21/24] `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 From ac2f824f2d98844a82d45c6119abe69cf26c5adb Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 14:46:01 +0100 Subject: [PATCH 22/24] `iptrunk_migration` - update to use the new storage path --- .../iptrunk_migration/tasks/bfd_update.yaml | 4 ++-- .../tasks/compile_template.yaml | 19 ++++++------------- .../tasks/configure_storage.yaml | 1 + .../tasks/deactivate_trunk_side.yaml | 4 ++-- .../tasks/delete_trunk_side.yaml | 4 ++-- .../tasks/deploy_object.yaml | 4 ++-- .../roles/iptrunk_migration/tasks/main.yml | 12 +++--------- 7 files changed, 18 insertions(+), 30 deletions(-) create mode 120000 geant/gap_ansible/roles/iptrunk_migration/tasks/configure_storage.yaml diff --git a/geant/gap_ansible/roles/iptrunk_migration/tasks/bfd_update.yaml b/geant/gap_ansible/roles/iptrunk_migration/tasks/bfd_update.yaml index 74842b76..10e8292a 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/tasks/bfd_update.yaml +++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/bfd_update.yaml @@ -8,7 +8,7 @@ dry_run | ansible.builtin.bool junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: set check_commit: true diff: true @@ -22,7 +22,7 @@ not (dry_run | ansible.builtin.bool) junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: set comment: "{{ commit_comment }}" diff: true diff --git a/geant/gap_ansible/roles/iptrunk_migration/tasks/compile_template.yaml b/geant/gap_ansible/roles/iptrunk_migration/tasks/compile_template.yaml index 80e59fe7..89d9c063 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/tasks/compile_template.yaml +++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/compile_template.yaml @@ -13,37 +13,30 @@ ( new_node.router.router_access_via_ts | ansible.builtin.bool ) is true and (verb == "deploy") -- 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 template for the old node "{{ old_node.fqdn }}" in "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" +- name: Print template for the old node "{{ old_node.fqdn }}" in "{{ play_storage_path }}/{{ config_object }}.conf" ansible.builtin.template: src: "{{ old_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' delegate_to: localhost when: (verb == "delete" or verb == "deactivate") and inventory_hostname != new_node.router.router_fqdn -- name: Print template for the new node in "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" +- name: Print template for the new node in "{{ play_storage_path }}/{{ config_object }}.conf" ansible.builtin.template: src: "{{ new_node.router.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' delegate_to: localhost when: (verb == "deploy") and inventory_hostname == new_node.router.router_fqdn -- name: Print template for the remaining node in "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" +- name: Print template for the remaining node in "{{ play_storage_path }}/{{ config_object }}.conf" ansible.builtin.template: src: "{{ remaining_side.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_migration/tasks/configure_storage.yaml b/geant/gap_ansible/roles/iptrunk_migration/tasks/configure_storage.yaml new file mode 120000 index 00000000..67d67dcb --- /dev/null +++ b/geant/gap_ansible/roles/iptrunk_migration/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_migration/tasks/deactivate_trunk_side.yaml b/geant/gap_ansible/roles/iptrunk_migration/tasks/deactivate_trunk_side.yaml index 2eb8ec6c..46e618bc 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/tasks/deactivate_trunk_side.yaml +++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/deactivate_trunk_side.yaml @@ -8,7 +8,7 @@ dry_run | ansible.builtin.bool junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: set check_commit: true diff: true @@ -22,7 +22,7 @@ not (dry_run | ansible.builtin.bool) junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: set comment: "{{ commit_comment }}" diff: true diff --git a/geant/gap_ansible/roles/iptrunk_migration/tasks/delete_trunk_side.yaml b/geant/gap_ansible/roles/iptrunk_migration/tasks/delete_trunk_side.yaml index ec7b2da4..af48e736 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/tasks/delete_trunk_side.yaml +++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/delete_trunk_side.yaml @@ -2,7 +2,7 @@ - name: Delete Trunk interface 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: set check_commit: true diff: true @@ -14,7 +14,7 @@ - name: Delete Trunk interface 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: set comment: "{{ commit_comment }}" diff: true diff --git a/geant/gap_ansible/roles/iptrunk_migration/tasks/deploy_object.yaml b/geant/gap_ansible/roles/iptrunk_migration/tasks/deploy_object.yaml index e9fd1683..0eb19691 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/tasks/deploy_object.yaml +++ b/geant/gap_ansible/roles/iptrunk_migration/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: set check_commit: true diff: true @@ -14,7 +14,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: set comment: "{{ commit_comment }}" diff: true diff --git a/geant/gap_ansible/roles/iptrunk_migration/tasks/main.yml b/geant/gap_ansible/roles/iptrunk_migration/tasks/main.yml index 92983df4..6b475754 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/tasks/main.yml +++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/main.yml @@ -20,11 +20,6 @@ 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: The old node is ansible.builtin.debug: msg: "{{ old_node.fqdn }}" @@ -33,6 +28,9 @@ ansible.builtin.debug: msg: "{{ new_node.router.router_fqdn }}" +- name: Include configure storage tasks + ansible.builtin.include_tasks: configure_storage.yaml + - name: Select the correct IPaddresses ansible.builtin.include_tasks: calculate_ips.yaml when: verb == "deploy" @@ -60,10 +58,6 @@ when: verb == "deploy" -- name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" - - name: Include compiling the template for the old node ansible.builtin.include_tasks: compile_template.yaml when: (verb == "deactivate" or verb == "delete") -- GitLab From 36736e3a967fa33e557cbf736ee426299ebd6630 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sat, 26 Apr 2025 18:06:54 +0100 Subject: [PATCH 23/24] `sdp` - update configure storage in standard way --- geant/gap_ansible/roles/sdp/tasks/configure_storage.yaml | 1 + geant/gap_ansible/roles/sdp/tasks/main.yml | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 120000 geant/gap_ansible/roles/sdp/tasks/configure_storage.yaml diff --git a/geant/gap_ansible/roles/sdp/tasks/configure_storage.yaml b/geant/gap_ansible/roles/sdp/tasks/configure_storage.yaml new file mode 120000 index 00000000..67d67dcb --- /dev/null +++ b/geant/gap_ansible/roles/sdp/tasks/configure_storage.yaml @@ -0,0 +1 @@ +../../../playbooks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/sdp/tasks/main.yml b/geant/gap_ansible/roles/sdp/tasks/main.yml index 356a4abd..874d3e68 100644 --- a/geant/gap_ansible/roles/sdp/tasks/main.yml +++ b/geant/gap_ansible/roles/sdp/tasks/main.yml @@ -18,8 +18,11 @@ when: (verb is not defined) or (verb not in verbs) ansible.builtin.meta: end_play -- name: Include standard tasks - ansible.builtin.include_tasks: standard_tasks.yaml +# - name: Include standard tasks +# ansible.builtin.include_tasks: standard_tasks.yaml + +- name: Include configure storage tasks + ansible.builtin.include_tasks: configure_storage.yaml - name: Include merge vars tasks ansible.builtin.include_tasks: merge_vars.yaml -- GitLab From 830536bfb28927579d855fdddc90ef31ed012aa3 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Sun, 27 Apr 2025 14:07:00 +0100 Subject: [PATCH 24/24] move `configure_storage` tasklist into separate `tasks` folder. --- geant/gap_ansible/playbooks/l3_core_service.yaml | 2 +- geant/gap_ansible/playbooks/manage_bgp_peers.yaml | 2 +- geant/gap_ansible/playbooks/manage_sbp.yaml | 2 +- geant/gap_ansible/playbooks/validate_prefix_list.yaml | 2 +- geant/gap_ansible/playbooks/vrf_update.yaml | 2 +- .../gap_ansible/roles/base_config/tasks/configure_storage.yaml | 2 +- geant/gap_ansible/roles/edge_port/tasks/configure_storage.yaml | 2 +- .../gap_ansible/roles/ibgp_update/tasks/configure_storage.yaml | 2 +- geant/gap_ansible/roles/iptrunk/tasks/configure_storage.yaml | 2 +- .../roles/iptrunk_migration/tasks/configure_storage.yaml | 2 +- .../roles/iptrunk_twamp/tasks/configure_storage.yaml | 2 +- geant/gap_ansible/roles/l2circuits/tasks/configure_storage.yaml | 2 +- .../roles/promote_p_to_pe/tasks/configure_storage.yaml | 2 +- geant/gap_ansible/roles/sdp/tasks/configure_storage.yaml | 2 +- geant/gap_ansible/{playbooks => tasks}/configure_storage.yaml | 0 15 files changed, 14 insertions(+), 14 deletions(-) rename geant/gap_ansible/{playbooks => tasks}/configure_storage.yaml (100%) diff --git a/geant/gap_ansible/playbooks/l3_core_service.yaml b/geant/gap_ansible/playbooks/l3_core_service.yaml index ae0166b0..6517b5bc 100644 --- a/geant/gap_ansible/playbooks/l3_core_service.yaml +++ b/geant/gap_ansible/playbooks/l3_core_service.yaml @@ -23,7 +23,7 @@ # ansible.builtin.meta: end_play - name: Include storage path configuration - ansible.builtin.include_tasks: configure_storage.yaml + ansible.builtin.include_tasks: ../tasks/configure_storage.yaml - name: Import standard general variables for GEANT L3 Core Services ansible.builtin.include_vars: diff --git a/geant/gap_ansible/playbooks/manage_bgp_peers.yaml b/geant/gap_ansible/playbooks/manage_bgp_peers.yaml index b5d5aa16..ed5898af 100644 --- a/geant/gap_ansible/playbooks/manage_bgp_peers.yaml +++ b/geant/gap_ansible/playbooks/manage_bgp_peers.yaml @@ -3,7 +3,7 @@ gather_facts: false tasks: - name: Include storage path configuration - ansible.builtin.include_tasks: configure_storage.yaml + ansible.builtin.include_tasks: ../tasks/configure_storage.yaml - name: Import general variables for {{ partner_name | upper }} ansible.builtin.include_vars: diff --git a/geant/gap_ansible/playbooks/manage_sbp.yaml b/geant/gap_ansible/playbooks/manage_sbp.yaml index da45e517..7e1715b1 100644 --- a/geant/gap_ansible/playbooks/manage_sbp.yaml +++ b/geant/gap_ansible/playbooks/manage_sbp.yaml @@ -3,7 +3,7 @@ gather_facts: false tasks: - name: Include storage path configuration - ansible.builtin.include_tasks: configure_storage.yaml + ansible.builtin.include_tasks: ../tasks/configure_storage.yaml - name: Import standard general variables for GEANT L3 Core Services ansible.builtin.include_vars: diff --git a/geant/gap_ansible/playbooks/validate_prefix_list.yaml b/geant/gap_ansible/playbooks/validate_prefix_list.yaml index 833a8ffa..c868c8b6 100644 --- a/geant/gap_ansible/playbooks/validate_prefix_list.yaml +++ b/geant/gap_ansible/playbooks/validate_prefix_list.yaml @@ -4,7 +4,7 @@ gather_facts: false tasks: - name: Include storage path configuration - ansible.builtin.include_tasks: configure_storage.yaml + ansible.builtin.include_tasks: ../tasks/configure_storage.yaml - name: Import standard general variables for GEANT L3 Core Services ansible.builtin.include_vars: diff --git a/geant/gap_ansible/playbooks/vrf_update.yaml b/geant/gap_ansible/playbooks/vrf_update.yaml index d8e33ef1..86624164 100644 --- a/geant/gap_ansible/playbooks/vrf_update.yaml +++ b/geant/gap_ansible/playbooks/vrf_update.yaml @@ -4,7 +4,7 @@ gather_facts: false tasks: - name: Include storage path configuration - ansible.builtin.include_tasks: configure_storage.yaml + ansible.builtin.include_tasks: ../tasks/configure_storage.yaml - name: Import standard variables for "{{ subscription.product.product_type }}/{{ subscription.vrf.vrf_name | upper }}" ansible.builtin.include_vars: diff --git a/geant/gap_ansible/roles/base_config/tasks/configure_storage.yaml b/geant/gap_ansible/roles/base_config/tasks/configure_storage.yaml index 67d67dcb..0998fc94 120000 --- a/geant/gap_ansible/roles/base_config/tasks/configure_storage.yaml +++ b/geant/gap_ansible/roles/base_config/tasks/configure_storage.yaml @@ -1 +1 @@ -../../../playbooks/configure_storage.yaml \ No newline at end of file +../../../tasks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/edge_port/tasks/configure_storage.yaml b/geant/gap_ansible/roles/edge_port/tasks/configure_storage.yaml index 67d67dcb..0998fc94 120000 --- a/geant/gap_ansible/roles/edge_port/tasks/configure_storage.yaml +++ b/geant/gap_ansible/roles/edge_port/tasks/configure_storage.yaml @@ -1 +1 @@ -../../../playbooks/configure_storage.yaml \ No newline at end of file +../../../tasks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/ibgp_update/tasks/configure_storage.yaml b/geant/gap_ansible/roles/ibgp_update/tasks/configure_storage.yaml index 67d67dcb..0998fc94 120000 --- a/geant/gap_ansible/roles/ibgp_update/tasks/configure_storage.yaml +++ b/geant/gap_ansible/roles/ibgp_update/tasks/configure_storage.yaml @@ -1 +1 @@ -../../../playbooks/configure_storage.yaml \ No newline at end of file +../../../tasks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/iptrunk/tasks/configure_storage.yaml b/geant/gap_ansible/roles/iptrunk/tasks/configure_storage.yaml index 67d67dcb..0998fc94 120000 --- a/geant/gap_ansible/roles/iptrunk/tasks/configure_storage.yaml +++ b/geant/gap_ansible/roles/iptrunk/tasks/configure_storage.yaml @@ -1 +1 @@ -../../../playbooks/configure_storage.yaml \ No newline at end of file +../../../tasks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/iptrunk_migration/tasks/configure_storage.yaml b/geant/gap_ansible/roles/iptrunk_migration/tasks/configure_storage.yaml index 67d67dcb..0998fc94 120000 --- a/geant/gap_ansible/roles/iptrunk_migration/tasks/configure_storage.yaml +++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/configure_storage.yaml @@ -1 +1 @@ -../../../playbooks/configure_storage.yaml \ No newline at end of file +../../../tasks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/iptrunk_twamp/tasks/configure_storage.yaml b/geant/gap_ansible/roles/iptrunk_twamp/tasks/configure_storage.yaml index 67d67dcb..0998fc94 120000 --- a/geant/gap_ansible/roles/iptrunk_twamp/tasks/configure_storage.yaml +++ b/geant/gap_ansible/roles/iptrunk_twamp/tasks/configure_storage.yaml @@ -1 +1 @@ -../../../playbooks/configure_storage.yaml \ No newline at end of file +../../../tasks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/l2circuits/tasks/configure_storage.yaml b/geant/gap_ansible/roles/l2circuits/tasks/configure_storage.yaml index 67d67dcb..0998fc94 120000 --- a/geant/gap_ansible/roles/l2circuits/tasks/configure_storage.yaml +++ b/geant/gap_ansible/roles/l2circuits/tasks/configure_storage.yaml @@ -1 +1 @@ -../../../playbooks/configure_storage.yaml \ No newline at end of file +../../../tasks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/promote_p_to_pe/tasks/configure_storage.yaml b/geant/gap_ansible/roles/promote_p_to_pe/tasks/configure_storage.yaml index 67d67dcb..0998fc94 120000 --- a/geant/gap_ansible/roles/promote_p_to_pe/tasks/configure_storage.yaml +++ b/geant/gap_ansible/roles/promote_p_to_pe/tasks/configure_storage.yaml @@ -1 +1 @@ -../../../playbooks/configure_storage.yaml \ No newline at end of file +../../../tasks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/sdp/tasks/configure_storage.yaml b/geant/gap_ansible/roles/sdp/tasks/configure_storage.yaml index 67d67dcb..0998fc94 120000 --- a/geant/gap_ansible/roles/sdp/tasks/configure_storage.yaml +++ b/geant/gap_ansible/roles/sdp/tasks/configure_storage.yaml @@ -1 +1 @@ -../../../playbooks/configure_storage.yaml \ No newline at end of file +../../../tasks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/playbooks/configure_storage.yaml b/geant/gap_ansible/tasks/configure_storage.yaml similarity index 100% rename from geant/gap_ansible/playbooks/configure_storage.yaml rename to geant/gap_ansible/tasks/configure_storage.yaml -- GitLab