ansible/test/integration/targets/ios_user/tests/cli/basic.yaml
Matej Vadnjal 7c318d4e30 ios_user module - implement sshkey option (#38782)
* ios_user module - add sshkey support

* ios_user - Add version_added to sshkey option

* ios_user - pep8 indentation fixes in unit tests

* ios_user - use b64decode method that works on python 2 and 3
2018-07-19 10:28:52 -04:00

84 lines
1.9 KiB
YAML

---
- name: tear down old users if they exist (Setup)
ios_user:
aggregate:
- name: ansibletest1
- name: ansibletest2
- name: ansibletest3
state: absent
provider: "{{ cli }}"
- name: Create user (SetUp)
ios_user:
name: ansibletest1
privilege: 15
role: network-operator
state: present
provider: "{{ cli }}"
register: result
- assert:
that:
- 'result.changed == true'
- 'result.commands == ["username ansibletest1 view network-operator", "username ansibletest1 privilege 15"]'
- name: Collection of users (SetUp)
ios_user:
aggregate:
- name: ansibletest2
- name: ansibletest3
provider: "{{ cli }}"
state: present
view: network-admin
register: result
- assert:
that:
- 'result.changed == true'
- 'result.commands == ["username ansibletest2 view network-admin", "username ansibletest3 view network-admin"]'
- name: Add user again (Idempotent)
ios_user:
name: ansibletest1
privilege: 15
role: network-operator
state: present
provider: "{{ cli }}"
register: result
- assert:
that:
- 'result.changed == false'
- 'result.commands | length == 0'
- name: Add collection of users again (Idempotent)
ios_user:
aggregate:
- name: ansibletest2
- name: ansibletest3
provider: "{{ cli }}"
state: present
view: network-admin
register: result
- assert:
that:
- 'result.changed == false'
- 'result.commands | length == 0'
- name: tearDown
ios_user:
aggregate:
- name: ansibletest1
- name: ansibletest2
- name: ansibletest3
state: absent
provider: "{{ cli }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"no username ansibletest1" in result.commands[0]["command"]'
- '"no username ansibletest2" in result.commands[4]["command"]'
- '"no username ansibletest3" in result.commands[8]["command"]'