Vultr: Introducing vultr_block_storage_facts module (#43218)

This commit introduces a new module called vultr_block_storage_facts.

This module aims to return the list of block storage volume avaiable
in Vultr.
This commit is contained in:
Yanis Guenane 2018-08-17 19:32:13 +02:00 committed by René Moser
commit e635dc6969
4 changed files with 164 additions and 0 deletions

View file

@ -0,0 +1,3 @@
vultr_block_storage_name: ansibletest-volume
vultr_block_storage_size: 10
vultr_block_storage_region: New Jersey

View file

@ -0,0 +1,33 @@
# 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 block storage volume facts - empty resource
vultr_block_storage_facts:
- name: Create the block storage volume
vultr_block_storage:
name: '{{ vultr_block_storage_name }}'
size: '{{ vultr_block_storage_size }}'
region: '{{ vultr_block_storage_region }}'
- name: test gather vultr block storage volume facts in check mode
vultr_block_storage_facts:
check_mode: yes
- name: verify test gather vultr block storage volume facts in check mode
assert:
that:
- ansible_facts.vultr_block_storage_facts|selectattr('name','equalto','{{ vultr_block_storage_name }}') | list | count == 1
- name: test gather vultr block storage volume facts
vultr_block_storage_facts:
- name: verify test gather vultr block storage volume facts
assert:
that:
- ansible_facts.vultr_block_storage_facts|selectattr('name','equalto','{{ vultr_block_storage_name }}') | list | count == 1
- name: Delete the block storage volume
vultr_block_storage:
name: '{{ vultr_block_storage_name }}'
state: absent

View file

@ -7,6 +7,7 @@
roles:
- { role: vultr_account_facts, tags: test_vultr_account_facts }
- { role: vultr_block_storage, tags: test_vultr_block_storage }
- { role: vultr_block_storage_facts, tags: test_vultr_block_storage_facts }
- { role: vultr_dns_domain, tags: test_vultr_dns_domain }
- { role: vultr_dns_domain_facts, tags: test_vultr_dns_domain_facts }
- { role: vultr_dns_record, tags: test_vultr_dns_record }