Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNMP configuration is not idempotent #27

Open
squeeb opened this issue Mar 16, 2021 · 0 comments
Open

SNMP configuration is not idempotent #27

squeeb opened this issue Mar 16, 2021 · 0 comments

Comments

@squeeb
Copy link

squeeb commented Mar 16, 2021

SUMMARY

If an snmp community is already absent, then the play fails with the error:

TASK [dellemc.os6.os6_snmp : Provisioning SNMP configuration for os6] **********************************
fatal: [<REDACTED>]: FAILED! => {
    "changed": false,
    "command": "no snmp-server community <REDACTED>",
    "rc": -32603
}

MSG:

no snmp-server community <REDACTED>

Error:That community does not exists.

<REDACTED>(config)#
ISSUE TYPE
  • Bug Report
COMPONENT NAME

dellemc.os6.os6_snmp

ANSIBLE VERSION
ansible 2.10.5
  config file = /Volumes/Shared/squeeb/Code/ansible/ansible-oob-provisioning/ansible.cfg
  configured module search path = ['/Users/squeeb/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/squeeb/.pyenv/versions/3.9.1/lib/python3.9/site-packages/ansible
  executable location = /Users/squeeb/.pyenv/versions/3.9.1/bin/ansible
  python version = 3.9.1 (default, Feb  7 2021, 19:59:19) [Clang 12.0.0 (clang-1200.0.32.29)]
CONFIGURATION
ANSIBLE_PIPELINING(/Volumes/Shared/squeeb/Code/ansible/ansible-oob-provisioning/ansible.cfg) = True
COLLECTIONS_PATHS(/Volumes/Shared/squeeb/Code/ansible/ansible-oob-provisioning/ansible.cfg) = ['/Volumes/Shared/squeeb/Code/ansible/ansible-oob-provisioning/collections']
DEFAULT_FORKS(/Volumes/Shared/squeeb/Code/ansible/ansible-oob-provisioning/ansible.cfg) = 50
DEFAULT_HOST_LIST(/Volumes/Shared/squeeb/Code/ansible/ansible-oob-provisioning/ansible.cfg) = ['/Volumes/Shared/squeeb/Code/ansible/ansible-oob-provisioning/hosts']
DEFAULT_STDOUT_CALLBACK(/Volumes/Shared/squeeb/Code/ansible/ansible-oob-provisioning/ansible.cfg) = debug
DEFAULT_TIMEOUT(/Volumes/Shared/squeeb/Code/ansible/ansible-oob-provisioning/ansible.cfg) = 60
HOST_KEY_CHECKING(/Volumes/Shared/squeeb/Code/ansible/ansible-oob-provisioning/ansible.cfg) = False
RETRY_FILES_ENABLED(/Volumes/Shared/squeeb/Code/ansible/ansible-oob-provisioning/ansible.cfg) = False
OS / ENVIRONMENT
<REDACTED>#show version

Machine Description............... Dell Networking Switch
System Model ID................... N1548
Machine Type...................... Dell Networking N1548
Serial Number..................... CN0V143P2829889E0099A04
Manufacturer...................... 0xbc00
Burned In MAC Address............. 4CD9.8FE3.5515
System Object ID.................. 1.3.6.1.4.1.674.10895.3065
SOC Version....................... BCM56150_A0
HW Version........................ 2
CPLD Version...................... 16

unit active      backup      current-active next-active
---- ----------- ----------- -------------- --------------
1    6.3.3.14    6.3.3.14    6.3.3.14       6.3.3.14

STEPS TO REPRODUCE

Using the following playbook, the os6_snmp task fails when trying to remove an snmp community that has already been removed.

in group_vars/all.yaml:

snmp_communities:
  - name: '<REDACTED>'
    access_mode: 'ro'
    state: 'absent'
  - name: '<REDACTED>'
    access_mode: 'rw'
    state: 'absent'

in the playbook:

os6_snmp:
  snmp_community: '{{ snmp_communities }}'
EXPECTED RESULTS

task should be skipped if communities are not present

ACTUAL RESULTS
fatal: [<REDACTED>]: FAILED! => {
    "changed": false,
    "command": "no snmp-server community <REDACTED>",
    "invocation": {
        "module_args": {
            "after": null,
            "backup": false,
            "backup_options": null,
            "before": null,
            "config": null,
            "lines": null,
            "match": "line",
            "parents": null,
            "provider": null,
            "replace": "line",
            "save": false,
            "src": "\nno snmp-server community <REDACTED>\nno snmp-server community <REDACTED>\nsnmp-server contact \"<REDACTED>@<REDACTED>\"\nsnmp-server location \"<REDACTED>\"\n",
            "update": "merge"
        }
    },
    "rc": -32603
}

MSG:

no snmp-server community <REDACTED>

Error:That community does not exists.

<REDACTED>(config)#
ChristopherBorn added a commit to p1-tech/dellemc.os6 that referenced this issue Oct 24, 2023
account for bug reported. only add removal config if it exists

ansible-collections#27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant