diff --git a/geant/gap_ansible/roles/iptrunk/tasks/deploy_object.yaml b/geant/gap_ansible/roles/iptrunk/tasks/deploy_object.yaml index 67870f411578f2b767771f43f730727017ed18f6..44856221e4e5ae981280af7f6dffe753b7b3b241 100644 --- a/geant/gap_ansible/roles/iptrunk/tasks/deploy_object.yaml +++ b/geant/gap_ansible/roles/iptrunk/tasks/deploy_object.yaml @@ -6,11 +6,22 @@ src_format: text check_commit: true diff: true + register: output when: > verb == "deploy" and local_side.iptrunk_side_node.vendor == "juniper" and dry_run | ansible.builtin.bool +- name: Fail if there is any diff + ansible.builtin.fail: + msg: Trunk config drift detected!!! + when: > + output.changed | ansible.builtin.bool + and + is_verification_workflow | ansible.builtin.bool + and + local_side.iptrunk_side_node.vendor == "juniper" + - name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [AND COMMIT][JUNIPER] junipernetworks.junos.junos_config: update: 'replace' @@ -23,14 +34,6 @@ local_side.iptrunk_side_node.vendor == "juniper" and not (dry_run | ansible.builtin.bool) -# - name: Show real diff of "{{ config_object }}" -# ansible.builtin.debug: -# msg: "{{ response }}" -# when: > -# verb == "deploy" and -# local_side.iptrunk_side_node.vendor == "juniper" and -# not (dry_run | ansible.builtin.bool) - - name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [CHECK ONLY][NOKIA] # ansible.netcommon.netconf_config: geant.gap_ansible.nokia_netconf_config: @@ -39,12 +42,23 @@ content: "{{ lookup('ansible.builtin.template', '{{ local_side.iptrunk_side_node.vendor }}/{{ config_object }}.j2') }}" commit: true diff: true + register: output check_mode: true when: > verb == "deploy" and ( dry_run | ansible.builtin.bool ) is true and local_side.iptrunk_side_node.vendor == "nokia" +- name: Fail if there is any diff + ansible.builtin.fail: + msg: Trunk config drift detected!!! + when: > + output.changed | ansible.builtin.bool + and + is_verification_workflow | ansible.builtin.bool + and + local_side.iptrunk_side_node.vendor == "nokia" + - name: Deploy "{{ config_object }}"on "{{ inventory_hostname }}" [AND COMMIT][NOKIA] # ansible.netcommon.netconf_config: geant.gap_ansible.nokia_netconf_config: diff --git a/geant/gap_ansible/roles/iptrunk/templates/nokia/trunk_interface.j2 b/geant/gap_ansible/roles/iptrunk/templates/nokia/trunk_interface.j2 index 5890af48cb660bc6adfe34673ff22d02c586c2f5..59e08de4d391155974f04fc54fe34b1ca0c84cbe 100644 --- a/geant/gap_ansible/roles/iptrunk/templates/nokia/trunk_interface.j2 +++ b/geant/gap_ansible/roles/iptrunk/templates/nokia/trunk_interface.j2 @@ -96,7 +96,7 @@ <interface alu:operation="replace"> <interface-name>{{ local.ae_name | lower }}.0</interface-name> <admin-state>enable</admin-state> - <description>SRV_GLOBAL INFRASTRUCTURE BACKBONE #{{ trunk_direction_name_sorted[0] }}-{{ trunk_direction_name_sorted[1] }}-IPTRUNK ${{ trunk.id }}| {{ trunk_direction_name_sorted[0] }}-{{ trunk_direction_name_sorted[1] }} | {{ common.description }}</description> + <description>SRV_GLOBAL INFRASTRUCTURE BACKBONE #{{ trunk_direction_name_sorted[0] }}-{{ trunk_direction_name_sorted[1] }}-IPTRUNK ${{ trunk.id }} | {{ trunk_direction_name_sorted[0] }}-{{ trunk_direction_name_sorted[1] }} | {{ common.description }}</description> <ip-mtu>{{ mtu_ip }}</ip-mtu> <port>{{ local.ae_name | lower }}</port> <ipv4> diff --git a/geant/gap_ansible/roles/iptrunk/vars/main.yml b/geant/gap_ansible/roles/iptrunk/vars/main.yml index 3c9a8924136a6dff1e6adc2eb920e230105f6021..7d89ec25c7e6e8878d8747b50b8ea27639dc2567 100644 --- a/geant/gap_ansible/roles/iptrunk/vars/main.yml +++ b/geant/gap_ansible/roles/iptrunk/vars/main.yml @@ -4,6 +4,7 @@ # dry_run: "True" +is_verification_workflow: false verbs: - "compile" 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 78725f04ef7111fc84e409f1791d9e7c7d4f3fea..72336382bf44dc2a774bb99ea670f0e6f6677f1c 100644 --- a/geant/gap_ansible/roles/iptrunk_twamp/tasks/deploy_object.yaml +++ b/geant/gap_ansible/roles/iptrunk_twamp/tasks/deploy_object.yaml @@ -6,11 +6,22 @@ src_format: text check_commit: true diff: true + register: output when: > local_side.iptrunk_side_node.vendor == "juniper" and ( dry_run | ansible.builtin.bool ) +- name: Fail if there is any diff + ansible.builtin.fail: + msg: TWAMP config drift detected!!! + when: > + output.changed | ansible.builtin.bool + and + is_verification_workflow | ansible.builtin.bool + and + local_side.iptrunk_side_node.vendor == "juniper" + - name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [AND COMMIT][JUNIPER] junipernetworks.junos.junos_config: update: 'replace' @@ -31,12 +42,23 @@ content: "{{ lookup('ansible.builtin.template', '{{ local_side.iptrunk_side_node.vendor }}/{{ config_object }}.j2') }}" commit: true diff: true + register: output check_mode: true when: > local_side.iptrunk_side_node.vendor == "nokia" and ( dry_run | ansible.builtin.bool ) +- name: Fail if there is any diff + ansible.builtin.fail: + msg: TWAMP config drift detected!!! + when: > + output.changed | ansible.builtin.bool + and + is_verification_workflow | ansible.builtin.bool + and + local_side.iptrunk_side_node.vendor == "nokia" + - name: Deploy "{{ config_object }}"on "{{ inventory_hostname }}" [AND COMMIT][NOKIA] # ansible.netcommon.netconf_config: geant.gap_ansible.nokia_netconf_config: diff --git a/geant/gap_ansible/roles/iptrunk_twamp/vars/main.yml b/geant/gap_ansible/roles/iptrunk_twamp/vars/main.yml index ace9a7ac4a9f5463a660c58e4064c2e2a8d56605..a5c6e954c4150f3380948690e4af2499d64eb71c 100644 --- a/geant/gap_ansible/roles/iptrunk_twamp/vars/main.yml +++ b/geant/gap_ansible/roles/iptrunk_twamp/vars/main.yml @@ -4,6 +4,7 @@ # dry_run: "True" +is_verification_workflow: false nokia_twamp_server: