Automation

 View Only
last person joined: 3 days ago 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.
  • 1.  Ansible for Junos OS Developer Guide testing

    Posted 10-11-2024 09:46

    I'm currently testing "Ansible for Junos OS Developer Guide -ansible-pd-junos-reboot.yml".

    I only changed the inventory part, but an error occurred. For reference, I performed the previous test.

    If anyone has tested it, please give me some advice. I can't find the code source on github.

    =================

    ---
    - name: Reboot Junos device
      hosts: EX2300 
      connection: local
      gather_facts: no

      vars:
        wait_time_after_reboot: 300
        netconf_port: 830

      vars_prompt:
       - name: "reboot_confrimation"
         prompt: "This playbook reboots device. Enter 'yes' to continue"
         private: no

      tasks:
      - name: Checking Check
        fail: msg="Playbook run confirmation failed"
        when: reboot_confirmation != "yes"

      - name: checking NETCONF connectivity
        wait_for:
          host: "{{ inventory_hostname }}"
          port: "{{ netconf_port }}"
          timeout: 5

      - name: Reboot all RE on the junos device
        juniper.device.system:
          action: "reboot"
          in_min: 2
          all_re: True
        register: result
        notify:
          - pause_for_reboot
          - wait_reboot

      - name: Print response
        debug:
          var: result

      handlers:
        - name: pause_for_reboot
          pause:
            seconds: 180
          when: result.reboot
        - name: wait_reboot
          wait_for:
            host: "{{ inventory_hostname }}"
            port: "{{ netconf_port }}"
            timeout: "{{ wait_time_after_reboot }}"
          when: result.reboot

    ==================



    ------------------------------
    GYU NAM PARK
    ------------------------------


  • 2.  RE: Ansible for Junos OS Developer Guide testing

     
    Posted 10-12-2024 17:07

    Looks like you have some typo on variable name:

      vars_prompt:
       - name: "reboot_confrimation"
         prompt: "This playbook reboots device. Enter 'yes' to continue"
         private: no
    
    Should be:
      vars_prompt:
       - name: "reboot_confirmation"
         prompt: "This playbook reboots device. Enter 'yes' to continue"
         private: no

    Regards



    ------------------------------
    Andy Sharp
    ------------------------------



  • 3.  RE: Ansible for Junos OS Developer Guide testing

    Posted 10-20-2024 10:09

    Good eye @asharp!!



    ------------------------------
    Vincent Surillo
    ------------------------------



  • 4.  RE: Ansible for Junos OS Developer Guide testing

    Posted 10-20-2024 10:10

    Hello @GYU NAM PARK,

    The DARK background on the screen grab makes it really difficult to see the text.

    Thanks



    ------------------------------
    Vincent Surillo
    ------------------------------