mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-03-26 21:43:02 +00:00
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
66 lines
1.4 KiB
YAML
66 lines
1.4 KiB
YAML
---
|
|
- 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 }}"
|