...
https://github.com/Juniper/Intro-to-Using-Ansible-with-Junos-OS/wiki/Health-Checks
Junos Automation: Using Ansible to pull basic information from a network device
Widget Connector | ||
---|---|---|
|
...
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
jlk@ubuntu:/etc/ansible$ more /etc/ansible/hosts
[vsrx]
vsrx1
[srx300]
192.168.0.2
junos_get_facts |
| |||||||
jlk@ubuntu:/etc/ansible$ more /etc/ansible/facts.pb.yaml
---
- name: Get facts
hosts: vsrx
connection: local
gather_facts: no
roles:
- Juniper.junos
vars_prompt:
- name: ADMUSER
prompt: Username
private: no
- name: ADMPASS
prompt: password
private: yes
tasks:
- name: Get junos facts
junos_get_facts:
host: "{{ inventory_hostname }}"
user: "{{ ADMUSER }}"
passwd: "{{ ADMPASS }}"
register: junos
- name: Print facts
debug:
var: junos
...