Manage configuration on devices running Juniper JUNOS
Version added: 1.0.0
- This module provides an implementation for working with the active configuration running on Juniper JUNOS devices. It provides a set of arguments for loading configuration, performing rollback operations and zeroing the active configuration on the device.
The below requirements are needed on the host that executes this module.
- ncclient (>=v0.5.2)
Note
- This module requires the netconf system service be enabled on the remote device being managed.
- Abbreviated commands are NOT idempotent, see Network FAQ
- Loading JSON-formatted configuration json is supported starting in Junos OS Release 16.1 onwards.
- Update
override
not currently compatible withset
notation. - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4.
- Recommended connection is
netconf
. See the Junos OS Platform Options. - This module also works with
local
connections for legacy playbooks. - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide <junos_platform_options>`
- For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide <network_guide>`
- For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper.
- name: load configure file into device
junipernetworks.junos.junos_config:
src: srx.cfg
comment: update config
- name: load configure lines into device
junipernetworks.junos.junos_config:
lines:
- set interfaces ge-0/0/1 unit 0 description "Test interface"
- set vlans vlan01 description "Test vlan"
comment: update config
- name: Set routed VLAN interface (RVI) IPv4 address
junipernetworks.junos.junos_config:
lines:
- set vlans vlan01 vlan-id 1
- set interfaces irb unit 10 family inet address 10.0.0.1/24
- set vlans vlan01 l3-interface irb.10
- name: Check correctness of commit configuration
junipernetworks.junos.junos_config:
check_commit: true
- name: rollback the configuration to id 10
junipernetworks.junos.junos_config:
rollback: 10
- name: zero out the current configuration
junipernetworks.junos.junos_config:
zeroize: true
- name: Set VLAN access and trunking
junipernetworks.junos.junos_config:
lines:
- set vlans vlan02 vlan-id 6
- set interfaces ge-0/0/6.0 family ethernet-switching interface-mode access vlan
members vlan02
- set interfaces ge-0/0/6.0 family ethernet-switching interface-mode trunk vlan
members vlan02
- name: confirm a previous commit
junipernetworks.junos.junos_config:
confirm_commit: true
- name: for idempotency, use full-form commands
junipernetworks.junos.junos_config:
lines:
- set interfaces ge-0/0/1 unit 0 description "Test interface"
- name: configurable backup path
junipernetworks.junos.junos_config:
src: srx.cfg
backup: true
backup_options:
filename: backup.cfg
dir_path: /home/user
- name: Set description with timer to confirm commit
junipernetworks.junos.junos_config:
lines:
- set interfaces fxp0 description "wait for a commit confirmation for 3 minutes; otherwise, it will be rolled back."
confirm: 3
- name: Perform confirm commit
junipernetworks.junos.junos_config:
confirm_commit: true
Common return values are documented here, the following are the fields unique to this module:
- Peter Sprygada (@privateip)