W3cubDocs

/Ansible

junos_facts - Collect facts from remote device running Junos

New in version 2.1.

Synopsis

Collects fact information from a remote device running the Junos operating system. By default, the module will collect basic fact information from the device to be included with the hostvars. Additional fact information can be collected based on the configured set of arguments.

Requirements (on host that executes module)

  • junos-eznc

Options

parameter required default choices comments
config
no
The config argument instructs the fact module to collect the configuration from the remote device. The configuration is then included in return facts. By default, the configuration is returned as text. The config_format can be used to return different Junos configuration formats.
config_format
no text
  • xml
  • text
  • set
The config_format argument is used to specify the desired format of the configuration file. Devices support three configuration file formats. By default, the configuration from the device is returned as text. The other options include set and xml. If the xml option is chosen, the configuration file is returned as both xml and json.
host
yes
Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.
password
no
Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_PASSWORD will be used instead.
port
no 22
Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) device.
provider
no
Convenience method that allows all ios arguments to be passed as a dict object. All constraints (required, choices, etc) must be met either by individual arguments or values in this dict.
ssh_keyfile
no
Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_SSH_KEYFILE will be used instead.
username
no
Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_USERNAME will be used instead.

Examples

# the required set of connection arguments have been purposely left off
# the examples for brevity

- name: collect default set of facts
  junos_facts:

- name: collect default set of facts and configuration
  junos_facts:
    config: yes

- name: collect default set of facts and configuration in set format
  junos_facts:
    config: yes
    config_format: set

- name: collect default set of facts and configuration in XML and JSON format
  junos_facts:
    config: yes
    config_format: xml

Return Values

Common return values are documented here Common Return Values, the following are the fields unique to this module:

name description returned type sample
ansible_facts Returns the facts collect from the device always dict

Notes

Note

This module requires the netconf system service be enabled on the remote device being managed

This is a Core Module

For more information on what this means please read Core Modules

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/junos_facts_module.html