From e64e2c386ec658bb8ab57d6d9c7529b81664af65 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <aleksandr.kurbatov@GL1342-AKURBATOV.local> Date: Mon, 12 Aug 2024 17:43:49 +0100 Subject: [PATCH] Update SDP mesh Update SDP mesh will be also called separately, during a step in GSO (i.e. update all existing Nokia PE routers with this new promoted PE router). Hence, a separate playbook and set of new tasks in compily/deploy. --- .../playbooks/update_pe_sdp_mesh.yaml | 5 +++ .../tasks/compile_pe_base_config.yaml | 11 ++++++ .../tasks/deploy_pe_base_config.yaml | 34 +++++++++++++++++-- .../roles/promote_p_to_pe/tasks/main.yml | 4 +-- 4 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 geant/gap_ansible/playbooks/update_pe_sdp_mesh.yaml diff --git a/geant/gap_ansible/playbooks/update_pe_sdp_mesh.yaml b/geant/gap_ansible/playbooks/update_pe_sdp_mesh.yaml new file mode 100644 index 00000000..a895eece --- /dev/null +++ b/geant/gap_ansible/playbooks/update_pe_sdp_mesh.yaml @@ -0,0 +1,5 @@ +- name: Update SDP mesh + hosts: all + gather_facts: false + roles: + - ../roles/promote_p_to_pe diff --git a/geant/gap_ansible/roles/promote_p_to_pe/tasks/compile_pe_base_config.yaml b/geant/gap_ansible/roles/promote_p_to_pe/tasks/compile_pe_base_config.yaml index f14a0049..e9c7c23e 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/tasks/compile_pe_base_config.yaml +++ b/geant/gap_ansible/roles/promote_p_to_pe/tasks/compile_pe_base_config.yaml @@ -16,6 +16,7 @@ delegate_to: localhost - name: Print the template in "/var/tmp/ansible_run_{{ opid }}/base_config.conf" + when: verb == "deploy_pe_base_config" ansible.builtin.template: src: "routers/{{ subscription.router.vendor }}/pe_base_config.j2" dest: "/var/tmp/ansible_run_{{ opid }}/pe_base_config.conf" @@ -24,6 +25,16 @@ mode: '0755' delegate_to: localhost +- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/sdp_mesh.conf" + when: verb == "update_sdp_mesh" + ansible.builtin.template: + src: "routers/{{ subscription.router.vendor }}/sdp_mesh.j2" + dest: "/var/tmp/ansible_run_{{ opid }}/sdp_mesh.conf" + lstrip_blocks: true + trim_blocks: true + mode: '0755' + delegate_to: localhost + - name: Set back ansible_host to target terminal server if needed when: subscription.router.router_access_via_ts | ansible.builtin.bool diff --git a/geant/gap_ansible/roles/promote_p_to_pe/tasks/deploy_pe_base_config.yaml b/geant/gap_ansible/roles/promote_p_to_pe/tasks/deploy_pe_base_config.yaml index be782b82..3503ab20 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/tasks/deploy_pe_base_config.yaml +++ b/geant/gap_ansible/roles/promote_p_to_pe/tasks/deploy_pe_base_config.yaml @@ -1,5 +1,7 @@ - name: Deploy base_config on "{{ inventory_hostname }}" [CHECK ONLY][NOKIA] - when: dry_run | ansible.builtin.bool + when: >- + dry_run | ansible.builtin.bool + and verb == "deploy_pe_base_config" geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge @@ -10,6 +12,19 @@ register: output check_mode: true +- name: Deploy SDP mesh on "{{ inventory_hostname }}" [CHECK ONLY][NOKIA] + when: >- + dry_run | ansible.builtin.bool + and verb == "update_sdp_mesh" + geant.gap_ansible.nokia_netconf_config: + format: xml + default_operation: merge + content: "{{ lookup('ansible.builtin.template', 'routers/{{ subscription.router.vendor }}/sdp_mesh.j2') }}" + commit: true + validate: true + diff: true + register: output + check_mode: true # - name: Fail if there is any diff # ansible.builtin.fail: @@ -20,7 +35,9 @@ # is_verification_workflow | ansible.builtin.bool - name: Deploy base_config on "{{ inventory_hostname }}" [AND COMMIT][NOKIA] - when: not (dry_run | ansible.builtin.bool) + when: >- + not (dry_run | ansible.builtin.bool) and + verb == "deploy_pe_base_config" geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge @@ -29,3 +46,16 @@ commit_comment: "{{ commit_comment }}" diff: true check_mode: false + +- name: Deploy updated SDP mesh on "{{ inventory_hostname }}" [AND COMMIT][NOKIA] + when: >- + not (dry_run | ansible.builtin.bool) and + verb == "update_sdp_mesh" + geant.gap_ansible.nokia_netconf_config: + format: xml + default_operation: merge + content: "{{ lookup('ansible.builtin.template', 'routers/{{ subscription.router.vendor }}/sdp_mesh.j2') }}" + commit: true + commit_comment: "{{ commit_comment }}" + diff: true + check_mode: false 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 66e43782..41dc0e6e 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 @@ -49,11 +49,11 @@ ansible.builtin.include_tasks: configure_isis_overload.yaml - name: Include templates compilation - when: verb == 'deploy_pe_base_config' + when: verb in [ 'deploy_pe_base_config', 'update_sdp_mesh' ] ansible.builtin.include_tasks: compile_pe_base_config.yaml - name: Include deploy if selected - when: verb == 'deploy_pe_base_config' + when: verb in [ 'deploy_pe_base_config', 'update_sdp_mesh' ] ansible.builtin.include_tasks: deploy_pe_base_config.yaml - name: Include deletion of default static routes -- GitLab