mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Vultr: Introducing vultr_server_facts module (#43001)
This commit introduces a new module called vultr_server_facts.
This module aims to return the list of servers avaiable avaiable in
Vultr.
Sample available here:
```
"vultr_server_facts": [
{
"allowed_bandwidth_gb": 1000,
"application": null,
"auto_backup_enabled": false,
"cost_per_month": 5.00,
"current_bandwidth_gb": 0,
"date_created": "2018-07-19 08:23:03",
"default_password": "p4ssw0rd!",
"disk": "Virtual 25 GB",
"firewallgroup": null,
"id": 17241096,
"internal_ip": "",
"kvm_url": "https://my.vultr.com/subs/vps/novnc/api.php?data=OFB...",
"name": "ansibletest",
"os": "CentOS 7 x64",
"pending_charges": 0.01,
"plan": "1024 MB RAM,25 GB SSD,1.00 TB BW",
"power_status": "running",
"ram": "1024 MB",
"region": "Amsterdam",
"server_state": "ok",
"status": "active",
"tag": "",
"v4_gateway": "105.178.158.1",
"v4_main_ip": "105.178.158.181",
"v4_netmask": "255.255.254.0",
"v6_main_ip": "",
"v6_network": "",
"v6_network_size": "",
"v6_networks": [],
"vcpu_count": 1
}
]
This commit is contained in:
committed by
René Moser
parent
c84e70cf10
commit
2556098479
4
test/legacy/roles/vultr_server_facts/defaults/main.yml
Normal file
4
test/legacy/roles/vultr_server_facts/defaults/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
vultr_server_name: ansibletest
|
||||
vultr_server_os: CentOS 7 x64
|
||||
vultr_server_plan: 1024 MB RAM,25 GB SSD,1.00 TB BW
|
||||
vultr_server_region: Amsterdam
|
||||
38
test/legacy/roles/vultr_server_facts/tasks/main.yml
Normal file
38
test/legacy/roles/vultr_server_facts/tasks/main.yml
Normal file
@@ -0,0 +1,38 @@
|
||||
# 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: test gather vultr server facts - empty resources
|
||||
vultr_server_facts:
|
||||
|
||||
- name: Create the server
|
||||
vultr_server:
|
||||
name: '{{ vultr_server_name }}'
|
||||
os: '{{ vultr_server_os }}'
|
||||
plan: '{{ vultr_server_plan }}'
|
||||
region: '{{ vultr_server_region }}'
|
||||
|
||||
- name: test gather vultr server facts in check mode
|
||||
vultr_server_facts:
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather vultr server facts in check mode
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.vultr_server_facts|selectattr('name','equalto','{{ vultr_server_name }}') | list | count == 1
|
||||
|
||||
- name: test gather vultr server facts
|
||||
vultr_server_facts:
|
||||
|
||||
- name: verify test gather vultr server facts
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.vultr_server_facts|selectattr('name','equalto','{{ vultr_server_name }}') | list | count == 1
|
||||
|
||||
- name: Pause for 5 min before deleting the VM
|
||||
pause:
|
||||
minutes: 5
|
||||
|
||||
- name: Delete the server
|
||||
vultr_server:
|
||||
name: '{{ vultr_server_name }}'
|
||||
state: absent
|
||||
@@ -16,6 +16,7 @@
|
||||
- { role: vultr_plan_facts, tags: test_vultr_plan_facts }
|
||||
- { role: vultr_region_facts, tags: test_vultr_region_facts }
|
||||
- { role: vultr_server, tags: test_vultr_server }
|
||||
- { role: vultr_server_facts, tags: test_vultr_server_facts }
|
||||
- { role: vultr_ssh_key, tags: test_vultr_ssh_key }
|
||||
- { role: vultr_ssh_key_facts, tags: test_vultr_ssh_key_facts }
|
||||
- { role: vultr_startup_script, tags: test_vultr_startup_script }
|
||||
|
||||
Reference in New Issue
Block a user