Author: | Jeremy Schulman, Juniper Networks |
---|
New in version 1.0.0.
Load a complete Junos OS configuration (overwrite) or merge a configuration snippet onto a device running Junos OS and commit it. The default behavior is to perform a load merge operation (overwrite=’no’). This module performs an atomic lock/edit/unlock. If the process fails at any step, then all configuration changes are discarded. You can load the configuration using either NETCONF or the CONSOLE port. Specify the console option to use the CONSOLE port. You provide the configuration data in a file. Supported formats when using NETCONF include ASCII text, Junos XML elements, and Junos OS set commands. Configurations performed through the console must only use ASCII text formatting.
parameter | required | default | choices | comments |
---|---|---|---|---|
comment | no | None | Provide a comment to the commit of the configuration | |
confirm | no | None | Provide a confirm in minutes to the commit of the configuration | |
console | no | None | Port configuration, per the netconify utility | |
diffs_file | no | None | Path to the file where any diffs will be written | |
file | yes | Path to the file containing the Junos OS configuration data. If the file has a *.conf extension, the content is treated as text format. If the file has a *.xml extension, the content is treated as XML format. If the file has a *.set extension, the content is treated as Junos OS set commands. |
||
host | yes | Set to {{ inventory_hostname }} | ||
logfile | no | None | Path on the local server where the progress status is logged for debugging purposes | |
overwrite | no |
|
Specify whether the configuration file completely replaces the existing configuration. | |
passwd | no | assumes ssh-key active | Login password | |
port | no | 830 | TCP port number to use when connecting to the device | |
replace | no |
|
Specify whether the configuration file uses "replace:" statements. (NETCONF only) NOT compatible with set format | |
savedir | no | None | Path to the local server directory where device facts and inventory files will be stored. This option is used only with the console option. Refer to the netconify utility for details. | |
timeout | no | 0 | Extend the NETCONF RPC timeout beyond the default value of 30 seconds. Set this value to accommodate configuration changes (commits) that might take longer than the default timeout interval. | |
user | no | $USER | Login username |
Note
Requires junos-eznc >= 1.2.2
Note
Requires junos-netconify >= 1.0.1, when using the console option
# load merge a change to the Junos OS configuration using NETCONF
- junos_install_config:
host={{ inventory_hostname }}
file=banner.conf
# load overwrite a new Junos OS configuration using the CONSOLE port
- junos_install_config:
host={{ inventory_hostname }}
console="--telnet={{TERMSERV}},{{TERMSERV_PORT}}"
file=default_new_switch.conf
overwrite=yes
# load merge a change to the Junos OS configuration using NETCONF and supplying a commit log message
- junos_install_config:
host={{ inventory_hostname }}
file=banner.conf
comment="configured by ansible"
# load replace a change to the Junos OS configuration using NETCONF
- junos_install_config:
host={{ inventory_hostname }}
file=snmp.conf
replace=yes