junos_get_facts¶
Synopsis¶
Added in version 1.0.0
Retrieve facts for a device running Junos OS, which includes information such as the serial number, product model, and Junos OS version. The module supports using both NETCONF and CONSOLE-based retrieval and returns the information as a JSON dictionary. The information is similar to facts gathered by other IT frameworks.
Options¶
| parameter | required | default | choices | comments |
|---|---|---|---|---|
| console | no | None |
CONSOLE port, per the netconify utility |
|
| host | yes |
Set to {{ inventory_hostname }} |
||
| logfile | no | None |
Path on the local server where the progress status is logged for debugging purposes. This option is used only with the console option. |
|
| passwd | no | assumes ssh-key active |
Login password |
|
| port | no | 830 |
TCP port number to use when connecting to the device |
|
| savedir | no | $CWD |
Path to the local server directory where device fact files will be stored. Resulting file will be savedir/hostname-facts.json |
|
| user | no | $USER |
Login username |
Important
Requires junos-eznc >= 1.2.2
Important
Requires junos-netconify >= 1.0.1, when using the console option
Examples¶
# retrieve facts using NETCONF, assumes ssh-keys
- junos_get_facts: host={{ inventory_hostname }}
register: junos
# retrieve facts using CONSOLE, assumes Amnesiac system
# root login, no password
- junos_get_facts:
host={{ inventory_hostname }}
user=root
console="--telnet={{TERMSERV}},{{TERMSERVPORT}}"
savedir=/usr/local/junos/inventory
register: junos
# access the facts
- name: version
debug: msg="{{ junos.facts.version }}"