ansible-collections / cisco.nxos

Ansible Network Collection for Cisco NXOS
GNU General Public License v3.0
115 stars 108 forks source link

cisco.nxos.nxos_logging is not idempotent #150

Closed feisacrabel closed 4 years ago

feisacrabel commented 4 years ago
SUMMARY

the logging module is not idempotent, looks like the parameters the logging command pushes compare to how the switch stores the config is different

ISSUE TYPE
COMPONENT NAME

cisco.nxos.nxos_logging

ANSIBLE VERSION

ansible 2.9.13 config file = /home/feisa/ansible-network/ansible.cfg configured module search path = ['/home/feisa/ansible-network/library'] ansible python module location = /usr/lib/python3.6/site-packages/ansible executable location = /usr/bin/ansible python version = 3.6.8 (default, Dec 5 2019, 15:45:45) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]

CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE

run the following task


EXPECTED RESULTS

logging server splunk 6 use-vrf default facility auth logging source-interface loopback0 logging timestamp milliseconds

ACTUAL RESULTS

"commands": [ "logging server splunk 6 facility auth use-vrf default", "logging source-interface loopback 0", "logging timestamp milliseconds"

NilashishC commented 4 years ago

@feisacrabel The difference in the structure of the commands is pushed vs how they are rendered natively on the box is not an issue. The task that you shared attempts to configure three separate logging config lines and as such, they need to be provided separately in the task as well, through the aggregate key. For example, your task should look something like:

 - cisco.nxos.nxos_logging:
     aggregate:
       - {dest: server, remote_server: splunk, facility_level: 6, use_vrf: default, facility: auth}
       - {interface: Ethernet1/4}
       - {timerstamp: milliseconds}

I believe this should make the playbook idempotent. Can you please try it out and let us know? Thank you!

feisacrabel commented 4 years ago

using the aggregate attribute worked

NilashishC commented 4 years ago

@feisacrabel Glad to hear that. I will be closing this ticket now. Thanks again!