mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-05-14 13:32:07 +00:00
Add volume_manage module
This module introduces the ability to use the cinder manage and unmanage of an existing volume on a cinder backend. Due to API limitations, when unmanaging a volume, only the volume ID can be provided. Change-Id: If969f198864e6bd65dbb9fce4923af1674da34bc
This commit is contained in:
65
ci/roles/volume_manage/tasks/main.yml
Normal file
65
ci/roles/volume_manage/tasks/main.yml
Normal file
@@ -0,0 +1,65 @@
|
||||
---
|
||||
- name: Create volume
|
||||
openstack.cloud.volume:
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
size: 1
|
||||
name: "{{ test_volume }}"
|
||||
description: Test volume
|
||||
register: vol
|
||||
|
||||
- assert:
|
||||
that: item in vol.volume
|
||||
loop: "{{ expected_fields }}"
|
||||
|
||||
- name: Unmanage volume
|
||||
openstack.cloud.volume_manage:
|
||||
cloud: "{{ cloud }}"
|
||||
state: absent
|
||||
name: "{{ vol.volume.id }}"
|
||||
|
||||
- name: Unmanage volume again
|
||||
openstack.cloud.volume_manage:
|
||||
cloud: "{{ cloud }}"
|
||||
state: absent
|
||||
name: "{{ vol.volume.id }}"
|
||||
register: unmanage_idempotency
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- unmanage_idempotency is not changed
|
||||
|
||||
- name: Manage volume
|
||||
openstack.cloud.volume_manage:
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
source_name: volume-{{ vol.volume.id }}
|
||||
host: "{{ vol.volume.host }}"
|
||||
name: "{{ managed_volume }}"
|
||||
register: new_vol
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- new_vol.volume.name == "{{ managed_volume }}"
|
||||
|
||||
- name: Manage volume again
|
||||
openstack.cloud.volume_manage:
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
source_name: volume-{{ vol.volume.id }}
|
||||
host: "{{ vol.volume.host }}"
|
||||
name: "{{ managed_volume }}"
|
||||
register: vol_idempotency
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- vol_idempotency is not changed
|
||||
|
||||
- pause:
|
||||
seconds: 10
|
||||
|
||||
- name: Delete volume
|
||||
openstack.cloud.volume:
|
||||
cloud: "{{ cloud }}"
|
||||
state: absent
|
||||
name: "{{ managed_volume }}"
|
||||
Reference in New Issue
Block a user