nclu – Configure network interfaces using NCLU¶
Synopsis¶
Interface to the Network Command Line Utility, developed to make it easier to configure operating systems running ifupdown2 and Quagga, such as Cumulus Linux. Command documentation is available at https://docs.cumulusnetworks.com/cumulus-linux/System-Configuration/Network-Command-Line-Utility-NCLU/
Parameters¶
Examples¶
- name: Add two interfaces without committing any changes
nclu:
commands:
- add int swp1
- add int swp2
- name: Modify hostname to Cumulus-1 and commit the change
nclu:
commands:
- add hostname Cumulus-1
commit: true
- name: Add 48 interfaces and commit the change.
nclu:
template: |
{% for iface in range(1,49) %}
add int swp{{iface}}
{% endfor %}
commit: true
description: "Ansible - add swps1-48"
- name: Fetch Status Of Interface
nclu:
commands:
- show interface swp1
register: output
- name: Print Status Of Interface
debug:
var: output
- name: Fetch Details From All Interfaces In JSON Format
nclu:
commands:
- show interface json
register: output
- name: Print Interface Details
debug:
var: output["msg"]
- name: Atomically add an interface
nclu:
commands:
- add int swp1
atomic: true
description: "Ansible - add swp1"
- name: Remove IP address from interface swp1
nclu:
commands:
- del int swp1 ip address 1.1.1.1/24
- name: Configure BGP AS and add 2 EBGP neighbors using BGP Unnumbered
nclu:
commands:
- add bgp autonomous-system 65000
- add bgp neighbor swp51 interface remote-as external
- add bgp neighbor swp52 interface remote-as external
commit: true
- name: Configure BGP AS and Add 2 EBGP neighbors Using BGP Unnumbered via Template
nclu:
template: |
{% for neighbor in range(51,53) %}
add bgp neighbor swp{{neighbor}} interface remote-as external
add bgp autonomous-system 65000
{% endfor %}
atomic: true
- name: Check BGP Status
nclu:
commands:
- show bgp summary json
register: output
- name: Print BGP Status In JSON
debug:
var: output["msg"]
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
changed
boolean
|
changed |
whether the interface was changed
Sample:
True
|
msg
string
|
always |
human-readable report of success or failure
Sample:
interface bond0 config updated
|
Status¶
This module is not guaranteed to have a backwards compatible interface. [preview]
This module is maintained by the Ansible Community. [community]
Authors¶
Cumulus Networks (@isharacomix)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.