2017-10-26 17:27:55 +02:00
|
|
|
---
|
2018-01-05 18:39:04 +01:00
|
|
|
- debug: msg="START connection={{ ansible_connection }} nxos_snmp_user sanity test"
|
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
2017-10-26 17:27:55 +02:00
|
|
|
|
2018-05-08 08:27:12 +02:00
|
|
|
- name: Remove snmp user
|
2017-10-26 17:27:55 +02:00
|
|
|
nxos_snmp_user: &remove
|
|
|
|
user: ntc
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-10-26 17:27:55 +02:00
|
|
|
state: absent
|
|
|
|
|
2018-05-08 08:27:12 +02:00
|
|
|
- pause:
|
|
|
|
seconds: 5
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Create snmp user
|
|
|
|
nxos_snmp_user: &create
|
|
|
|
user: ntc
|
|
|
|
group: network-operator
|
|
|
|
authentication: md5
|
|
|
|
pwd: N$tOpe%1
|
|
|
|
privacy: HelloU$er1
|
|
|
|
encrypt: true
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2018-05-08 08:27:12 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &true
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: Add another group to user
|
|
|
|
nxos_snmp_user: &chg
|
|
|
|
user: ntc
|
|
|
|
group: network-admin
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2018-05-08 08:27:12 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Check Idempotence"
|
|
|
|
nxos_snmp_user: *chg
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &false
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: Remove group from user
|
|
|
|
nxos_snmp_user: &remg
|
|
|
|
user: ntc
|
|
|
|
group: network-admin
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2018-05-08 08:27:12 +02:00
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- pause:
|
|
|
|
seconds: 5
|
|
|
|
|
|
|
|
- name: "Check Idempotence"
|
|
|
|
nxos_snmp_user: *remg
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: delete snmp user
|
|
|
|
nxos_snmp_user: &remove1
|
|
|
|
user: ntc
|
|
|
|
group: network-operator
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2018-05-08 08:27:12 +02:00
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- pause:
|
|
|
|
seconds: 5
|
|
|
|
|
|
|
|
- name: "Remove Idempotence"
|
|
|
|
nxos_snmp_user: *remove1
|
|
|
|
register: result
|
2017-10-26 17:27:55 +02:00
|
|
|
|
2018-05-08 08:27:12 +02:00
|
|
|
- assert: *false
|
2017-10-26 17:27:55 +02:00
|
|
|
|
2018-05-08 08:27:12 +02:00
|
|
|
always:
|
|
|
|
- name: delete snmp user
|
|
|
|
nxos_snmp_user: *remove
|
2017-10-26 17:27:55 +02:00
|
|
|
|
2018-01-05 18:39:04 +01:00
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_snmp_user sanity test"
|