cli_config – Push text based configuration to network devices over network_cli
cli_config – Push text based configuration to network devices over network_cli
New in version 2.7.
Synopsis
- This module provides platform agnostic way of pushing text based configuration to network devices over network_cli connection plugin.
Parameters
Parameter | Choices/Defaults | Comments |
---|---|---|
commit boolean |
|
The |
commit_comment string |
The | |
config string |
The config to be pushed to the network device. This argument is mutually exclusive with | |
defaults boolean |
|
The defaults argument will influence how the running-config is collected from the device. When the value is set to true, the command used to collect the running-config is append with the all keyword. When the value is set to false, the command is issued without the all keyword. |
diff_ignore_lines - |
Use this argument to specify one or more lines that should be ignored during the diff. This is used for lines in the configuration that are automatically updated by the system. This argument takes a list of regular expressions or exact line matches. Note that this parameter will be ignored if the platform has onbox diff support. | |
diff_match - |
|
Instructs the module on the way to perform the matching of the set of commands against the current device config. If |
diff_replace - |
|
Instructs the module on the way to perform the configuration on the device. If the |
multiline_delimiter string |
This argument is used when pushing a multiline configuration element to the device. It specifies the character to use as the delimiting character. This only applies to the configuration action. | |
replace string |
If the | |
rollback - |
The |
Examples
- name: configure device with config
cli_config:
config: "{{ lookup('template', 'basic/config.j2') }}"
- name: multiline config
cli_config:
config: |
hostname foo
feature nxapi
- name: configure device with config with defaults enabled
cli_config:
config: "{{ lookup('template', 'basic/config.j2') }}"
defaults: yes
- name: Use diff_match
cli_config:
config: "{{ lookup('file', 'interface_config') }}"
diff_match: none
- name: nxos replace config
cli_config:
replace: 'bootflash:nxoscfg'
- name: commit with comment
cli_config:
config: set system host-name foo
commit_comment: this is a test
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
commands list |
always |
The set of commands that will be pushed to the remote device
Sample: ['interface Loopback999', 'no shutdown'] |
Status
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Network Team. [network]
Red Hat Support
More information about Red Hat’s support of this module is available from this Red Hat Knowledge Base article.
Authors
- Trishna Guha (@trishnaguha)
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.7/modules/cli_config_module.html