mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Vultr: Introducing vultrr_block_storage module (#43202)
This commit introduces a new module called vultr_block_storage/ It allows a user to manage block storage volumes on the Vultr cloud.
This commit is contained in:
committed by
René Moser
parent
899eddf9e4
commit
57497a490b
4
test/legacy/roles/vultr_block_storage/defaults/main.yml
Normal file
4
test/legacy/roles/vultr_block_storage/defaults/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
vultr_block_storage_name: ansible-test-vm1
|
||||
vultr_block_storage_size: 10
|
||||
vultr_block_storage_region: New Jersey
|
||||
111
test/legacy/roles/vultr_block_storage/tasks/main.yml
Normal file
111
test/legacy/roles/vultr_block_storage/tasks/main.yml
Normal file
@@ -0,0 +1,111 @@
|
||||
# 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: setup
|
||||
vultr_block_storage:
|
||||
name: "{{ vultr_block_storage_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify setup
|
||||
assert:
|
||||
that:
|
||||
- result is success
|
||||
|
||||
- name: test fail if missing name
|
||||
vultr_block_storage:
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
- name: verify test fail if missing name
|
||||
assert:
|
||||
that:
|
||||
- result is failed
|
||||
- 'result.msg == "missing required arguments: name"'
|
||||
|
||||
- name: test fail if missing params for state=present
|
||||
vultr_block_storage:
|
||||
name: "{{ vultr_block_storage_name }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
- name: verify fail if missing params for state=present
|
||||
assert:
|
||||
that:
|
||||
- result is failed
|
||||
- 'result.msg == "state is present but all of the following are missing: size, region"'
|
||||
|
||||
- name: test create block storage volume in check mode
|
||||
vultr_block_storage:
|
||||
name: "{{ vultr_block_storage_name }}"
|
||||
size: "{{ vultr_block_storage_size }}"
|
||||
region: "{{ vultr_block_storage_region }}"
|
||||
register: result
|
||||
check_mode: yes
|
||||
- name: verify test create server in check mode
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: test create block storage volume
|
||||
vultr_block_storage:
|
||||
name: "{{ vultr_block_storage_name }}"
|
||||
size: "{{ vultr_block_storage_size }}"
|
||||
region: "{{ vultr_block_storage_region }}"
|
||||
register: result
|
||||
|
||||
- name: verify test create block storage volume
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_block_storage.name == "{{ vultr_block_storage_name }}"
|
||||
- result.vultr_block_storage.region == "{{ vultr_block_storage_region }}"
|
||||
- result.vultr_block_storage.size == 10
|
||||
|
||||
- name: test create block storage volume idempotence
|
||||
vultr_block_storage:
|
||||
name: "{{ vultr_block_storage_name }}"
|
||||
size: "{{ vultr_block_storage_size }}"
|
||||
region: "{{ vultr_block_storage_region }}"
|
||||
register: result
|
||||
|
||||
- name: verify test block storage volume idempotence
|
||||
assert:
|
||||
that:
|
||||
- result is not changed
|
||||
- result.vultr_block_storage.name == "{{ vultr_block_storage_name }}"
|
||||
- result.vultr_block_storage.region == "{{ vultr_block_storage_region }}"
|
||||
- result.vultr_block_storage.size == 10
|
||||
|
||||
- name: test destroy block storage volume in check mode
|
||||
vultr_block_storage:
|
||||
name: "{{ vultr_block_storage_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test destroy block storage volume in check mode
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_block_storage.name == "{{ vultr_block_storage_name }}"
|
||||
|
||||
- name: test destroy block storage volume
|
||||
vultr_block_storage:
|
||||
name: "{{ vultr_block_storage_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: verify test destroy an existing block storage volume
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_block_storage.name == "{{ vultr_block_storage_name }}"
|
||||
|
||||
- name: test destroy an existing block storage volume idempotence
|
||||
vultr_block_storage:
|
||||
name: "{{ vultr_block_storage_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: verify test destroy an existing block storage volume idempotence
|
||||
assert:
|
||||
that:
|
||||
- result is not changed
|
||||
@@ -6,6 +6,7 @@
|
||||
connection: local
|
||||
roles:
|
||||
- { role: vultr_account_facts, tags: test_vultr_account_facts }
|
||||
- { role: vultr_block_storage, tags: test_vultr_block_storage }
|
||||
- { 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 }
|
||||
|
||||
Reference in New Issue
Block a user