From 521eb06bc3df8efd0eabdb5a891dc3252561b37d Mon Sep 17 00:00:00 2001
From: Aleksandr Kurbatov <aleksandr.kurbatov@GL1342.local>
Date: Thu, 7 Mar 2024 15:21:30 +0000
Subject: [PATCH] deactivate_trunk_side: module update

`juniper_junos` -> `junipernetworks.junos`
---
 .../tasks/deactivate_trunk_side.yaml          | 38 +++++--------------
 .../tasks/delete_trunk_side.yaml              | 38 +++++--------------
 .../tasks/deploy_object.yaml                  | 38 +++++--------------
 3 files changed, 27 insertions(+), 87 deletions(-)

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 f880605a..afeecf91 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
@@ -1,43 +1,23 @@
 ---
 - name: Deactivate Trunk interface on  "{{ inventory_hostname }}" [CHECK ONLY][JUNIPER]
-  juniper_junos_config:
-    load: 'replace'
+  junipernetworks.junos.junos_config:
+    update: 'replace'
     src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf"
-    format: set
-    config_mode: "private"
-    check: true
-    commit: false
-  register: response
+    src_format: set
+    check_commit: true
+  diff: true
   when: >
     verb == "deactivate" and
     local_side.iptrunk_side_node.vendor == "juniper" and
     dry_run | ansible.builtin.bool
 
-- name: Show DRY diff of "{{ config_object }}"
-  ansible.builtin.debug:
-    msg: "{{ response }}"
-  when: >
-    verb == "deactivate"
-    and dry_run | ansible.builtin.bool and
-    local_side.iptrunk_side_node.vendor == "juniper"
-
 - name: Deactivate Trunk interface on "{{ inventory_hostname }}" [AND COMMIT][JUNIPER]
-  juniper_junos_config:
-    load: 'replace'
+  junipernetworks.junos.junos_config:
+    update: 'replace'
     src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf"
-    format: set
-    config_mode: "private"
-    commit: true
+    src_format: set
     comment: "{{ commit_comment }}"
-  register: response
-  when: >
-    verb == "deactivate" and
-    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 }}"
+  diff: true
   when: >
     verb == "deactivate" and
     local_side.iptrunk_side_node.vendor == "juniper" and
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 9adaafab..ec7b2da4 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
@@ -1,43 +1,23 @@
 ---
 - name: Delete Trunk interface on  "{{ inventory_hostname }}" [CHECK ONLY][JUNIPER]
-  juniper_junos_config:
-    load: 'replace'
+  junipernetworks.junos.junos_config:
+    update: 'replace'
     src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf"
-    format: set
-    config_mode: "private"
-    check: true
-    commit: false
-  register: response
+    src_format: set
+    check_commit: true
+  diff: true
   when: >
     verb == "delete" and
     local_side.iptrunk_side_node.vendor == "juniper" and
     dry_run | ansible.builtin.bool
 
-- name: Show DRY diff of "{{ config_object }}"
-  ansible.builtin.debug:
-    msg: "{{ response }}"
-  when: >
-    verb == "delete"
-    and dry_run | ansible.builtin.bool and
-    local_side.iptrunk_side_node.vendor == "juniper"
-
 - name: Delete Trunk interface on "{{ inventory_hostname }}" [AND COMMIT][JUNIPER]
-  juniper_junos_config:
-    load: 'replace'
+  junipernetworks.junos.junos_config:
+    update: 'replace'
     src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf"
-    format: set
-    config_mode: "private"
-    commit: true
+    src_format: set
     comment: "{{ commit_comment }}"
-  register: response
-  when: >
-    verb == "delete" and
-    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 }}"
+  diff: true
   when: >
     verb == "delete" and
     local_side.iptrunk_side_node.vendor == "juniper" and
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 7b4731a8..9aba18ef 100644
--- a/geant/gap_ansible/roles/iptrunk_migration/tasks/deploy_object.yaml
+++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/deploy_object.yaml
@@ -1,43 +1,23 @@
 ---
 - name: Deploy "{{ config_object }}" on  "{{ inventory_hostname }}" [CHECK ONLY][JUNIPER]
-  juniper_junos_config:
-    load: 'replace'
+  junipernetworks.junos.junos_config:
+    update: 'replace'
     src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf"
-    format: text
-    config_mode: "private"
-    check: true
-    commit: false
-  register: response
+    src_format: set
+    check_commit: true
+  diff: true
   when: >
     verb == "deploy" and
     new_node.router.vendor == "juniper" and
     dry_run | ansible.builtin.bool
 
-- name: Show DRY diff of "{{ config_object }}"
-  ansible.builtin.debug:
-    msg: "{{ response }}"
-  when: >
-    verb == "deploy"
-    and dry_run | ansible.builtin.bool and
-    new_node.router.vendor == "juniper"
-
 - name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [AND COMMIT][JUNIPER]
-  juniper_junos_config:
-    load: 'replace'
+  junipernetworks.junos.junos_config:
+    update: 'replace'
     src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf"
-    format: text
-    config_mode: "private"
-    commit: true
+    src_format: set
     comment: "{{ commit_comment }}"
-  register: response
-  when: >
-    verb == "deploy" and
-    new_node.router.vendor == "juniper" and
-    not (dry_run | ansible.builtin.bool)
-
-- name: Show real diff of "{{ config_object }}"
-  ansible.builtin.debug:
-    msg: "{{ response }}"
+  diff: true
   when: >
     verb == "deploy" and
     new_node.router.vendor == "juniper" and
-- 
GitLab