ansible / ansible.builtin / v2.9.4 / module / junos_facts Collect facts from remote devices running Juniper Junos | "added in version" 2.1 of ansible.builtin" Authors: Nathaniel Case (@Qalthos) preview | supported by networkansible.builtin.junos_facts (v2.9.4) — module
pip
Install with pip install ansible==2.9.4
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.
- name: collect default set of facts junos_facts:
- name: collect default set of facts and configuration junos_facts: gather_subset: config
- name: Gather legacy and resource facts junos_facts: gather_subset: all gather_network_resources: all
provider: description: - B(Deprecated) - 'Starting with Ansible 2.5 we recommend using C(connection: network_cli) or C(connection: netconf).' - For more information please see the L(Junos OS Platform Options guide, ../network/user_guide/platform_junos.html). - HORIZONTALLINE - A dict object containing connection details. suboptions: host: description: - 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. type: str password: description: - 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 C(ANSIBLE_NET_PASSWORD) will be used instead. type: str port: description: - 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 C(transport=cli)) or port 830 (for C(transport=netconf)) device. type: int ssh_keyfile: description: - 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 C(ANSIBLE_NET_SSH_KEYFILE) will be used instead. type: path timeout: description: - Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. type: int transport: choices: - cli - netconf default: netconf description: - Configures the transport connection to use when connecting to the remote device. type: str username: description: - 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 C(ANSIBLE_NET_USERNAME) will be used instead. type: str type: dict config_format: choices: - xml - text - set - json default: text description: - The I(config_format) argument specifies the format of the configuration when serializing output from the device. This argument is applicable only when C(config) value is present in I(gather_subset). The I(config_format) should be supported by the junos version running on device. This value is not applicable while fetching old style facts that is when C(ofacts) value is present in value if I(gather_subset) value. This option is valid only for C(gather_subset) values. required: false version_added: '2.3' version_added_collection: ansible.builtin gather_subset: default: - '!config' description: - When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument include all, hardware, config, and interfaces. Can specify a list of values to include a larger subset. Values can also be used with an initial C(M(!)) to specify that a specific subset should not be collected. To maintain backward compatibility old style facts can be retrieved by explicitly adding C(ofacts) to value, this requires junos-eznc to be installed as a prerequisite. Valid value of gather_subset are default, hardware, config, interfaces, ofacts. If C(ofacts) is present in the list it fetches the old style facts (fact keys without 'ansible_' prefix) and it requires junos-eznc library to be installed on control node and the device login credentials must be given in C(provider) option. required: false version_added: '2.3' version_added_collection: ansible.builtin gather_network_resources: description: - When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument include all and the resources like interfaces, vlans etc. Can specify a list of values to include a larger subset. Values can also be used with an initial C(M(!)) to specify that a specific subset should not be collected. Valid subsets are 'all', 'interfaces', 'lacp', 'lacp_interfaces', 'lag_interfaces', 'l2_interfaces', 'l3_interfaces', 'lldp_global', 'lldp_interfaces', 'vlans'. required: false version_added: '2.9' version_added_collection: ansible.builtin
ansible_facts: description: Returns the facts collect from the device returned: always type: dict