From b712c698fc40e38a9aad92a8228b17d981f1420f Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <aleksandr.kurbatov@GL1342.local> Date: Thu, 15 Feb 2024 22:52:04 +0000 Subject: [PATCH] Juniper.junos -> junipernetworks.junos Update in module usage --- .../base_config/tasks/deploy_base_config.yaml | 40 +++++++------------ .../tasks/base_config_checks_juniper.yaml | 5 +++ .../roles/base_config_checks/tasks/main.yml | 10 ++++- 3 files changed, 29 insertions(+), 26 deletions(-) create mode 100644 geant/gap_ansible/roles/base_config_checks/tasks/base_config_checks_juniper.yaml 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 8594621f..8594962c 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,31 +1,21 @@ - name: Deploy base_config on "{{ inventory_hostname }}" [CHECK ONLY][Juniper] - juniper_junos_config: - load: 'replace' + junipernetworks.junos.junos_config: + update: 'replace' src: "/var/tmp/ansible_run_{{ opid }}/{{ mytemplates.template_name }}.conf" - format: text - config_mode: "private" - check: true - commit: false - register: response + src_format: text + check_commit: true + diff: true when: > verb == "deploy" and ( dry_run | ansible.builtin.bool ) is true and wfo_router.router.vendor == "juniper" -- name: Show diff for dry run - ansible.builtin.debug: - msg: "{{ response }}" - when: > - verb == "deploy" and - ( dry_run | ansible.builtin.bool ) is true and - wfo_router.router.vendor == "juniper" - name: Deploy base_config on "{{ inventory_hostname }}" [AND COMMIT][Juniper] - juniper_junos_config: - load: 'replace' + junipernetworks.junos.junos_config: + update: 'replace' src: "/var/tmp/ansible_run_{{ opid }}/{{ mytemplates.template_name }}.conf" - format: text - config_mode: "private" + src_format: text comment: "{{ commit_comment }}" register: response when: > @@ -33,13 +23,13 @@ ( dry_run | ansible.builtin.bool ) is false and wfo_router.router.vendor == "juniper" -- name: Show diff - ansible.builtin.debug: - msg: "{{ response }}" - when: > - verb == "deploy" and - ( dry_run | ansible.builtin.bool ) is false and - wfo_router.router.vendor == "juniper" +# - name: Show diff +# ansible.builtin.debug: +# msg: "{{ response }}" +# when: > +# verb == "deploy" and +# ( dry_run | ansible.builtin.bool ) is false and +# wfo_router.router.vendor == "juniper" - name: Deploy base_config on "{{ inventory_hostname }}" [CHECK ONLY][NOKIA] ansible.netcommon.netconf_config: diff --git a/geant/gap_ansible/roles/base_config_checks/tasks/base_config_checks_juniper.yaml b/geant/gap_ansible/roles/base_config_checks/tasks/base_config_checks_juniper.yaml new file mode 100644 index 00000000..8ae1ef1d --- /dev/null +++ b/geant/gap_ansible/roles/base_config_checks/tasks/base_config_checks_juniper.yaml @@ -0,0 +1,5 @@ +- name: Base config Juniper checks + juniernetworks.junos.junos_command: + commands: + - show version + - show system alarms diff --git a/geant/gap_ansible/roles/base_config_checks/tasks/main.yml b/geant/gap_ansible/roles/base_config_checks/tasks/main.yml index adf864be..2dc23352 100644 --- a/geant/gap_ansible/roles/base_config_checks/tasks/main.yml +++ b/geant/gap_ansible/roles/base_config_checks/tasks/main.yml @@ -20,6 +20,14 @@ when: wfo_router.router.vendor == "juniper" -- name: Execute post-check command +- name: Execute post-check command [NOKIA] + when: + wfo_router.router.vendor == "nokia" ansible.builtin.include_tasks: base_config_single_command.yaml with_items: "{{ commands }}" + +- name: Execute post-check command [JUNIPER] + when: + wfo_router.router.vendor == "juniper" + ansible.builtin.include_tasks: base_config_checks_juniper.yaml + # with_items: "{{ commands }}" -- GitLab