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
------------------------------