Retrieve facts from a Junos device

New in version 2.0.0.


  • Retrieve facts from a Junos device using the PyEZ fact gathering system.
  • Also returns the committed configuration of the Junos device if the config_format option has a value other than none.


The following software packages must be installed on hosts that execute this module:

Module-specific Options

The following options may be specified for this module:

parameter type required default choices comments
no none
  • none
  • xml
  • set
  • text
  • json
The format of the configuration returned. The specified format must be supported by the target Junos device.
path no none
A path to a directory, on the Ansible control machine, where facts will be stored in a JSON file.
The resulting JSON file is saved in savedir/hostname-facts.json.
The savedir directory is the value of the savedir option.
The hostname-facts.json filename begins with the value of the hostname fact returned from the Junos device, which might be different than the value of the host option passed to the module.
If the value of the savedir option is none, the default, then facts are NOT saved to a file.


- name: Gather facts from Junos devices
  hosts: junos-all
  connection: local
  gather_facts: no
    - Juniper.junos
    - name: Gather Junos facts with no configuration

# Print a fact

# Using config_format option

# Print the config

# Using savedir option

# Print the saved JSON file



  • The NETCONF system service must be enabled on the target Junos device.


  • Juniper Networks - Stacy Smith (@stacywsmith)


This module is flagged as stableinterface which means that the maintainers for this module guarantee that no backward incompatible interface changes will be made.