2017-06-08 08:02:49 +00:00
|
|
|
---
|
2018-01-15 07:46:41 +00:00
|
|
|
- debug: msg="START connection={{ ansible_connection }} nxos_user basic test"
|
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
|
|
|
|
2017-08-02 04:58:12 +00:00
|
|
|
- name: Remove old entries of user
|
|
|
|
nxos_user:
|
|
|
|
aggregate:
|
2017-12-11 15:25:05 +00:00
|
|
|
- { name: ansibletest1 }
|
|
|
|
- { name: ansibletest2 }
|
|
|
|
- { name: ansibletest3 }
|
2017-08-02 04:58:12 +00:00
|
|
|
state: absent
|
2017-08-17 08:18:00 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-08-02 04:58:12 +00:00
|
|
|
|
|
|
|
# Start tests
|
2017-06-08 08:02:49 +00:00
|
|
|
- name: Create user
|
|
|
|
nxos_user:
|
2017-08-02 04:58:12 +00:00
|
|
|
name: ansibletest1
|
2017-06-08 08:02:49 +00:00
|
|
|
roles: network-operator
|
|
|
|
state: present
|
2017-08-17 08:18:00 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-06-08 08:02:49 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
2017-08-02 04:58:12 +00:00
|
|
|
- '"username" in result.commands[0]'
|
|
|
|
- '"role network-operator" in result.commands[1]'
|
2017-06-08 08:02:49 +00:00
|
|
|
|
|
|
|
- name: Collection of users
|
|
|
|
nxos_user:
|
2017-07-26 14:09:17 +00:00
|
|
|
aggregate:
|
2017-12-11 15:25:05 +00:00
|
|
|
- { name: ansibletest2 }
|
|
|
|
- { name: ansibletest3 }
|
2017-06-08 08:02:49 +00:00
|
|
|
state: present
|
|
|
|
roles: network-admin
|
2017-08-17 08:18:00 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-06-08 08:02:49 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
|
|
|
|
- name: tearDown
|
|
|
|
nxos_user:
|
2017-08-02 04:58:12 +00:00
|
|
|
aggregate:
|
2017-12-11 15:25:05 +00:00
|
|
|
- { name: ansibletest1 }
|
|
|
|
- { name: ansibletest2 }
|
|
|
|
- { name: ansibletest3 }
|
2017-08-02 04:58:12 +00:00
|
|
|
state: absent
|
2017-08-17 08:18:00 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-06-08 08:02:49 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
2017-08-02 04:58:12 +00:00
|
|
|
- '"no username" in result.commands[0]'
|
2018-01-15 07:46:41 +00:00
|
|
|
|
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_user basic test"
|