ansible-collections / community.network

Ansible Community Network Collection
http://galaxy.ansible.com/community/network
Other
125 stars 90 forks source link

edgeos_config detects changes where there are none #198

Open jplitza opened 3 years ago

jplitza commented 3 years ago
SUMMARY

When not passing save: yes to edgeos_config, it assumes that a delete command that matches existing configuration actually means a change. However, if the same configuration is re-added later, nothing really changes (not even transiently, because all chnages are committed together)

ISSUE TYPE
COMPONENT NAME

edgeos_config

ANSIBLE VERSION
ansible 2.9.10
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/.local/lib/python3.6/site-packages/ansible
  executable location = /home/user/.local/bin/ansible
  python version = 3.6.9 (default, Oct  8 2020, 12:12:24) [GCC 8.4.0]
CONFIGURATION
OS / ENVIRONMENT

Ubuntu 18.04

STEPS TO REPRODUCE
- hosts: all
  tasks:
  - edgeos_config:
      lines:
      - "delete system name-server"
      - "set system name-server 208.67.220.220"
  - edgeos_config:
      lines:
      - "delete system name-server"
      - "set system name-server 208.67.220.220"
EXPECTED RESULTS

The first task might change something, but the second effectively won't, because all settings are restored after the delete. This is actually useful to assert no other config exists at the same level (e.g. system name-servers, interface address, ...)

ACTUAL RESULTS

Both tasks supposedly change something.

ADDITIONAL NOTES

Currently, the module tries to determine which commands are necessary to execute in order to achieve the desired configuration by comparing the current (or provided) config with the commands in the invocation. Extending this to cover cases like these would certainly be possible, but an approximation at best.

In #184, support for diffs was added using the compare command. So I think it would be reasonable to use the compare command to determine changed status as well, since this is definitive: If that doesn't output any changes, the router won't change any configuration. Currently, it's possible to have changed: true but an empty diff.

ansibullbot commented 3 years ago

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 3 years ago

cc @Qalthos @samdoran click here for bot help

ansibullbot commented 3 years ago

@jplitza, just so you are aware we have a dedicated Working Group for network. You can find other people interested in this in #ansible-network on Freenode IRC For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

ansibullbot commented 3 years ago

cc @virtualguy click here for bot help