Open crytectobi opened 11 months ago
One way that I've found we can delete some config with netconf and Ansible it's RPC. You should use other module and pre-built rpc edit-config. To delete description for interface Ansible task will look like this
tasks:
- name: Delete description
ansible.netcommon.netconf_rpc:
rpc: edit-config
xmlns: urn:ietf:params:xml:ns:netconf:base:1.0
content: |
<target>
<running/>
</target>
<config xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
<native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native">
<interface>
<GigabitEthernet>
<name>1/0/2</name>
<description nc:operation="remove">test</description>
</GigabitEthernet>
</interface>
</native>
</config>
I tried it at another vendor than Cisco, but it worked for me.
SUMMARY
I tried to delete configuration from my IOS-XE switch with the ansible.netcommon.netconf_config module. Pushing configuration is working fine, also commiting is working fine. But how do I delete specific configuration from the switch? In this example I'm trying to delete the interface description:
The results is:
"parameters are mutually exclusive: content|source_datastore|delete|confirm_commit"
So when delete and content are not mutual, how do I define what I want to be deleted? I also tried this without the delete option:
The results is:
XML validation failed with error 'Namespace prefix nc for operation on description is not defined
And since there is no documentation example of the delete option, I don't know how to use this correctly. Can someone enlighten me and maybe add this to the documentation, if this is not a bug?
ISSUE TYPE
COMPONENT NAME
ansible.netcommon.netconf_config
ANSIBLE VERSION
COLLECTION VERSION
-->
CONFIGURATION
OS / ENVIRONMENT
Ansible is running on Ubuntu 22.04 WSL Cisco Catalyst Switch 9200 IOS-XE 17.12.1