mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
be11d12fa2
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
72 lines
1.6 KiB
YAML
72 lines
1.6 KiB
YAML
---
|
|
- name: Create user (SetUp)
|
|
vyos_user:
|
|
name: ansibletest1
|
|
password: test
|
|
state: present
|
|
provider: "{{ cli }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- '"set system login user" in result.commands'
|
|
- '"authentication plaintext-password" in result.commands'
|
|
|
|
- name: Collection of users (SetUp)
|
|
vyos_user:
|
|
users:
|
|
- name: ansibletest2
|
|
- name: ansibletest3
|
|
level: operator
|
|
state: present
|
|
provider: "{{ cli }}"
|
|
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
|
|
password: test
|
|
state: present
|
|
provider: "{{ cli }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == false'
|
|
- 'result.commands | length == 0'
|
|
|
|
- name: Add collection of users (Idempotent)
|
|
vyos_user:
|
|
users:
|
|
- name: ansibletest2
|
|
- name: ansibletest3
|
|
level: operator
|
|
state: present
|
|
provider: "{{ cli }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == false'
|
|
- 'result.commands | length == 0'
|
|
|
|
- name: tearDown
|
|
vyos_user:
|
|
users:
|
|
- name: ansibletest1
|
|
- name: ansibletest2
|
|
- name: ansibletest3
|
|
state: absent
|
|
provider: "{{ cli }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- 'result.commands == ["delete system login user ansibletest1", "delete system login user ansibletest2", "delete system login user ansibletest3"]'
|