Ansible NETCONF Configuration Not Committing Changes from Candidate to Running Datastore

73 views Asked by At

I am using the ansible.netcommon.netconf_config module to configure switches via NETCONF. When I push configuration data directly to the "candidate" datastore and commit it within the same task, the configuration is applied correctly without any issues. However, when I attempt to stage the changes first and then commit them in two separate tasks, the changes do not get committed from the "candidate" datastore to the "running" datastore.

Here's the Ansible task that works (single task for push and commit):

- name: Push NETCONF Data to Candidate Datastore and commit
  ansible.netcommon.netconf_config:
    backup: true
    target: "candidate"
    commit: true
    get_filter: |
      <System xmlns="http://cisco.com/ns/yang/cisco-nx-os-device">
        <name></name>
      </System>
    content: |
      <config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
        <System xmlns="http://cisco.com/ns/yang/cisco-nx-os-device">
          <name>ANSIBLE</name>
        </System>
      </config>

And here's the code that fails (separate tasks for push and commit):

- name: Push NETCONF Data to Candidate Datastore
  ansible.netcommon.netconf_config:
    backup: true
    target: "candidate"
    commit: false
    get_filter: |
      <System xmlns="http://cisco.com/ns/yang/cisco-nx-os-device">
        <name></name>
      </System>
    content: |
      <config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
        <System xmlns="http://cisco.com/ns/yang/cisco-nx-os-device">
          <name>ANSIBLETEST</name>
        </System>
      </config>

- name: Commit changes from candidate to running datastore
  ansible.netcommon.netconf_config:
    commit: true

When I run the second set of tasks, the configuration is pushed to the "candidate" datastore without any errors, but the commit to the "running" datastore does not happen. I've verified that the changes are present in the "candidate" datastore before the commit.

Is this behavior a bug, or am I missing something about how NETCONF or the ansible.netcommon.netconf_config module works? I would appreciate any suggestions or insights into this issue.

0

There are 0 answers