ansible/test/integration/targets/vyos_user/tests/cli/basic.yaml
Nathaniel Case 2425374fdd
Actually move vyos tests to network_cli (#33710)
* Fix vyos on network_cli on python3

bytes do not have format() in Python3

* Push connection to tasks, with bonus connection=local test

* Run tests without explicit connection set

* Add/update START messages where appropriate
2017-12-13 14:30:24 -05:00

77 lines
1.8 KiB
YAML

---
- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}"
- name: Setup
vyos_config:
lines:
- delete system login user ansibletest1
- delete system login user ansibletest2
- delete system login user ansibletest3
- name: Create user
vyos_user:
name: ansibletest1
configured_password: test
state: present
register: result
- assert:
that:
- 'result.changed == true'
- '"set system login user" in result.commands[0]'
- '"authentication plaintext-password" in result.commands[0]'
- name: Collection of users (SetUp)
vyos_user:
aggregate:
- name: ansibletest2
- name: ansibletest3
level: operator
state: present
register: result
- assert:
that:
- 'result.changed == true'
- 'result.commands == ["set system login user ansibletest2 level operator", "set system login user ansibletest3 level operator"]'
- name: Add user again (Idempotent)
vyos_user:
name: ansibletest1
configured_password: test
state: present
update_password: on_create
register: result
- assert:
that:
- 'result.changed == false'
- 'result.commands | length == 0'
- name: Add collection of users (Idempotent)
vyos_user:
aggregate:
- name: ansibletest2
- name: ansibletest3
level: operator
state: present
register: result
- assert:
that:
- 'result.changed == false'
- 'result.commands | length == 0'
- name: tearDown
vyos_user:
users:
- name: ansibletest1
- name: ansibletest2
- name: ansibletest3
state: absent
register: result
- assert:
that:
- 'result.changed == true'
- 'result.commands == ["delete system login user ansibletest1", "delete system login user ansibletest2", "delete system login user ansibletest3"]'