2017-06-08 06:58:29 +00:00
|
|
|
---
|
2017-08-16 06:38:59 +00:00
|
|
|
- name: Set Up
|
|
|
|
eos_config:
|
|
|
|
lines:
|
|
|
|
- no username ansibletest1
|
|
|
|
- no username ansibletest2
|
|
|
|
- no username ansibletest3
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
|
2017-06-08 06:58:29 +00:00
|
|
|
- name: Create user
|
|
|
|
eos_user:
|
2017-08-16 06:38:59 +00:00
|
|
|
name: ansibletest1
|
2017-06-08 06:58:29 +00:00
|
|
|
privilege: 15
|
|
|
|
role: network-operator
|
|
|
|
state: present
|
2017-08-31 19:29:57 +00:00
|
|
|
configured_password: test1
|
2017-06-08 06:58:29 +00:00
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
2017-08-31 19:29:57 +00:00
|
|
|
- '"username" in result.commands[0]'
|
|
|
|
- '"role network-operator" in result.commands[0]'
|
|
|
|
- '"privilege 15" in result.commands[1]'
|
|
|
|
- '"secret" in result.commands[2]'
|
2017-06-08 06:58:29 +00:00
|
|
|
|
|
|
|
- name: Collection of users
|
|
|
|
eos_user:
|
2017-07-26 14:09:17 +00:00
|
|
|
aggregate:
|
2017-08-31 19:29:57 +00:00
|
|
|
- { name: ansibletest2, configured_password: test2 }
|
|
|
|
- { name: ansibletest3, configured_password: test3 }
|
2017-06-08 06:58:29 +00:00
|
|
|
authorize: yes
|
|
|
|
state: present
|
2017-07-17 11:56:32 +00:00
|
|
|
role: network-operator
|
2017-06-08 06:58:29 +00:00
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
2017-08-31 19:29:57 +00:00
|
|
|
- '"username" in result.commands[0]'
|
|
|
|
- '"role network-operator" in result.commands[0]'
|
|
|
|
- '"secret" in result.commands[1]'
|
|
|
|
- '"username" in result.commands[2]'
|
|
|
|
- '"role network-operator" in result.commands[2]'
|
|
|
|
- '"secret" in result.commands[3]'
|
|
|
|
|
|
|
|
- name: Add user without password or nopassword arg(Should fail)
|
|
|
|
eos_user:
|
|
|
|
name: faileduser1
|
|
|
|
privilege: 15
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
ignore_errors: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
- 'result.failed == true'
|
|
|
|
- 'result.msg == "configured_password, sshkey or nopassword should be provided"'
|
2017-06-08 06:58:29 +00:00
|
|
|
|
|
|
|
- name: tearDown
|
2017-07-17 12:28:03 +00:00
|
|
|
eos_config:
|
|
|
|
lines:
|
2017-08-16 06:38:59 +00:00
|
|
|
- no username ansibletest1
|
|
|
|
- no username ansibletest2
|
|
|
|
- no username ansibletest3
|
2017-06-08 06:58:29 +00:00
|
|
|
provider: "{{ cli }}"
|