2017-06-08 13:32:49 +05:30
|
|
|
---
|
2017-08-02 10:28:12 +05:30
|
|
|
- name: Remove old entries of user
|
|
|
|
nxos_user:
|
|
|
|
aggregate:
|
|
|
|
- name: ansibletest1
|
|
|
|
- name: ansibletest2
|
|
|
|
- name: ansibletest3
|
|
|
|
state: absent
|
2017-08-17 04:18:00 -04:00
|
|
|
provider: "{{ connection }}"
|
2017-08-02 10:28:12 +05:30
|
|
|
|
|
|
|
# Start tests
|
2017-06-08 13:32:49 +05:30
|
|
|
- name: Create user
|
|
|
|
nxos_user:
|
2017-08-02 10:28:12 +05:30
|
|
|
name: ansibletest1
|
2017-06-08 13:32:49 +05:30
|
|
|
roles: network-operator
|
|
|
|
state: present
|
2017-08-17 04:18:00 -04:00
|
|
|
provider: "{{ connection }}"
|
2017-06-08 13:32:49 +05:30
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
2017-08-02 10:28:12 +05:30
|
|
|
- '"username" in result.commands[0]'
|
|
|
|
- '"role network-operator" in result.commands[1]'
|
2017-06-08 13:32:49 +05:30
|
|
|
|
|
|
|
- name: Collection of users
|
|
|
|
nxos_user:
|
2017-07-26 10:09:17 -04:00
|
|
|
aggregate:
|
2017-08-02 10:28:12 +05:30
|
|
|
- name: ansibletest2
|
|
|
|
- name: ansibletest3
|
2017-06-08 13:32:49 +05:30
|
|
|
state: present
|
|
|
|
roles: network-admin
|
2017-08-17 04:18:00 -04:00
|
|
|
provider: "{{ connection }}"
|
2017-06-08 13:32:49 +05:30
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
|
|
|
|
- name: tearDown
|
|
|
|
nxos_user:
|
2017-08-02 10:28:12 +05:30
|
|
|
aggregate:
|
|
|
|
- name: ansibletest1
|
|
|
|
- name: ansibletest2
|
|
|
|
- name: ansibletest3
|
|
|
|
state: absent
|
2017-08-17 04:18:00 -04:00
|
|
|
provider: "{{ connection }}"
|
2017-06-08 13:32:49 +05:30
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
2017-08-02 10:28:12 +05:30
|
|
|
- '"no username" in result.commands[0]'
|