mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Vultr: Introducing vr_user_facts module (#42951)
This commit introduces a new module called vr_user_facts.
This module aims to return the list of user avaiable avaiable in Vultr.
Sample available here:
```
"vultr_user_facts": [
{
"acls": [],
"api_enabled": "yes",
"email": "mytestuser@example.com",
"id": "a235b4f45e87f",
"name": "mytestuser"
}
]
```
This commit is contained in:
committed by
René Moser
parent
b16fef9aad
commit
2c4ba7a9e9
8
test/legacy/roles/vr_user_facts/defaults/main.yml
Normal file
8
test/legacy/roles/vr_user_facts/defaults/main.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
user_name: mytestuser
|
||||
user_email: mytestuser@example.com
|
||||
user_password: aP4ssw0rd!
|
||||
user_acls:
|
||||
- upgrade
|
||||
- dns
|
||||
- manage_users
|
||||
- subscriptions
|
||||
31
test/legacy/roles/vr_user_facts/tasks/main.yml
Normal file
31
test/legacy/roles/vr_user_facts/tasks/main.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
# Copyright (c) 2018, Yanis Guenane <yanis+ansible@guenane.org>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: Create the user
|
||||
vr_user:
|
||||
name: '{{ user_name }}'
|
||||
email: '{{ user_email }}'
|
||||
password: '{{ user_password }}'
|
||||
acls: '{{ user_acls }}'
|
||||
|
||||
- name: test gather vultr user facts in check mode
|
||||
vr_user_facts:
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather vultr user facts in check mode
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.vultr_user_facts|selectattr('name','equalto','{{ user_name }}') | list | count == 1
|
||||
|
||||
- name: test gather vultr user facts
|
||||
vr_user_facts:
|
||||
|
||||
- name: verify test gather vultr user facts
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.vultr_user_facts|selectattr('name','equalto','{{ user_name }}') | list | count == 1
|
||||
|
||||
- name: Delete the user
|
||||
vr_user:
|
||||
name: '{{ user_name }}'
|
||||
state: absent
|
||||
@@ -18,3 +18,4 @@
|
||||
- { role: vr_ssh_key_facts, tags: test_vr_ssh_key_facts }
|
||||
- { role: vr_startup_script, tags: test_vr_startup_script }
|
||||
- { role: vr_user, tags: test_vr_user }
|
||||
- { role: vr_user_facts, tags: test_vr_user_facts }
|
||||
|
||||
Reference in New Issue
Block a user