ansible/test/integration/targets/eos_user/tests/cli/basic.yaml
Nathaniel Case 7f5d1ab2b7
Removed in 29 (#63680)
* Eh, 2.10 is close enough

* drop top-level authorize

* Remove from documentation

* Remove load_params

* Centralize this junos thing

* Fixup user modules

* I'm 95% sure this did not do what it was supposed to

* nxos_hsrp: I don't think this is an actual module parameter

* Try to fix junos_package tests

* Move local params to provider

* Promote 'timeout' to a real parameter for eos_eapi

* Don't assume provider exists?

* move another timeout

* Provider now always has auth_pass

* Fix junos tests to avoid NameErrors
2019-10-24 15:01:05 -04:00

96 lines
2.4 KiB
YAML

---
- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}"
- name: Set Up
eos_config:
lines:
- no username ansibletest1
- no username ansibletest2
- no username ansibletest3
- no username ansibletest4
provider: "{{ cli }}"
become: yes
- name: Create user with role
eos_user:
name: ansibletest1
privilege: 15
role: network-operator
state: present
configured_password: test1
provider: "{{ cli }}"
become: yes
register: result
- assert:
that:
- 'result.changed == true'
- '"username" in result.commands[0]'
- '"secret" in result.commands[0]'
- '"role network-operator" in result.commands[1]'
- '"privilege 15" in result.commands[2]'
- name: Create user with priv level and update_password
eos_user:
name: ansibletest4
privilege: 15
state: present
configured_password: test1
update_password: on_create
provider: "{{ cli }}"
become: yes
register: result
- assert:
that:
- 'result.changed == true'
- '"username" in result.commands[0]'
- '"secret" in result.commands[0]'
- '"privilege 15" in result.commands[1]'
- name: Collection of users
eos_user:
aggregate:
- { name: ansibletest2, configured_password: test2 }
- { name: ansibletest3, configured_password: test3 }
state: present
role: network-operator
provider: "{{ cli }}"
become: yes
register: result
- assert:
that:
- 'result.changed == true'
- '"username" in result.commands[0]'
- '"role network-operator" in result.commands[1]'
- '"secret" in result.commands[0]'
- '"username" in result.commands[2]'
- '"role network-operator" in result.commands[3]'
- '"secret" in result.commands[2]'
- name: Add user without password or nopassword arg(Should fail)
eos_user:
name: faileduser1
privilege: 15
state: present
provider: "{{ cli }}"
become: yes
ignore_errors: yes
register: result
- assert:
that:
- 'result.changed == false'
- 'result.failed == true'
- 'result.msg == "configured_password, sshkey or nopassword should be provided"'
- name: tearDown
eos_config:
lines:
- no username ansibletest1
- no username ansibletest2
- no username ansibletest3
- no username ansibletest4
provider: "{{ cli }}"
become: yes