mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
Add vyos_user implementation module (#25677)
* Add vyos_user implementation module Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Integration test for vyos_user Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Make state absent work Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Unit test for vyos_user Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Standardize user names Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Modify integration test with idempotent case Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Add role as alias to level Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
parent
13a1111dde
commit
b3c22a96bd
8 changed files with 490 additions and 0 deletions
71
test/integration/targets/vyos_user/tests/cli/basic.yaml
Normal file
71
test/integration/targets/vyos_user/tests/cli/basic.yaml
Normal file
|
@ -0,0 +1,71 @@
|
|||
---
|
||||
- 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 ansibletest1 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"]'
|
Loading…
Add table
Add a link
Reference in a new issue