2017-09-15 14:45:51 +00:00
|
|
|
---
|
2018-01-05 17:39:04 +00:00
|
|
|
- debug: msg="START connection={{ ansible_connection }} nxos_snmp_community sanity test"
|
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
2017-09-15 14:45:51 +00:00
|
|
|
|
|
|
|
- name: Setup - Remove snmp_community if configured
|
|
|
|
nxos_snmp_community: &remove
|
|
|
|
community: TESTING7
|
|
|
|
group: network-operator
|
|
|
|
state: absent
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- block:
|
|
|
|
|
|
|
|
- name: Configure snmp_community group
|
|
|
|
nxos_snmp_community: &config
|
|
|
|
community: TESTING7
|
|
|
|
group: network-operator
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &true
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: Idempotence Check
|
|
|
|
nxos_snmp_community: *config
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &false
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
2018-04-25 07:46:41 +00:00
|
|
|
- name: Change snmp_community group
|
|
|
|
nxos_snmp_community: &chg
|
|
|
|
community: TESTING7
|
|
|
|
group: network-admin
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: Idempotence Check
|
|
|
|
nxos_snmp_community: *chg
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
2017-09-15 14:45:51 +00:00
|
|
|
- name: Remove snmp_community
|
|
|
|
nxos_snmp_community: *remove
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: Idempotence Check
|
|
|
|
nxos_snmp_community: *remove
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: Configure snmp_community access read-only
|
|
|
|
nxos_snmp_community: &configaccess
|
|
|
|
community: TESTING7
|
|
|
|
access: ro
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: Idempotence Check
|
|
|
|
nxos_snmp_community: *configaccess
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: Remove snmp_community
|
|
|
|
nxos_snmp_community: *remove
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: Idempotence Check
|
|
|
|
nxos_snmp_community: *remove
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: Configure snmp_community access read-write
|
|
|
|
nxos_snmp_community: &configaccessrw
|
|
|
|
community: TESTING7
|
|
|
|
access: rw
|
|
|
|
acl: ansible_acl
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: Idempotence Check
|
|
|
|
nxos_snmp_community: *configaccessrw
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
2018-04-25 07:46:41 +00:00
|
|
|
- name: Change acl
|
|
|
|
nxos_snmp_community: &chgacl
|
|
|
|
community: TESTING7
|
|
|
|
access: rw
|
|
|
|
acl: new_acl
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: Idempotence Check
|
|
|
|
nxos_snmp_community: *chgacl
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: Remove acl
|
|
|
|
nxos_snmp_community: &removeacl
|
|
|
|
community: TESTING7
|
|
|
|
access: rw
|
|
|
|
acl: default
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: Idempotence Check
|
|
|
|
nxos_snmp_community: *removeacl
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
2017-09-15 14:45:51 +00:00
|
|
|
always:
|
|
|
|
- name: Cleanup
|
|
|
|
nxos_snmp_community: *remove
|
|
|
|
|
2018-01-05 17:39:04 +00:00
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_snmp_community sanity test"
|