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] `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