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