Files
ansible-collections-openstack/ci/roles/volume/tasks/main.yml
Jakob Meng b3c2e8f1ce Refactored volume_snapshot{,_info} modules
Change-Id: I70fc744f786a9de654592c97188af48ddbe8751d
2022-11-08 13:48:57 +01:00

103 lines
2.4 KiB
YAML

---
- name: Create volume
openstack.cloud.volume:
cloud: "{{ cloud }}"
state: present
size: 1
name: ansible_volume
description: Test volume
register: vol
- assert:
that: item in vol.volume
loop: "{{ expected_fields }}"
- name: Create volume from existing volume
openstack.cloud.volume:
cloud: "{{ cloud }}"
state: present
size: 1
volume: "{{ vol.volume.id }}"
name: ansible_volume1
description: Test volume
- name: Delete volume
openstack.cloud.volume:
cloud: "{{ cloud }}"
state: absent
name: ansible_volume1
- name: Delete volume
openstack.cloud.volume:
cloud: "{{ cloud }}"
state: absent
name: ansible_volume
- name: Test images
block:
- name: Ensure clean environment
ansible.builtin.set_fact:
tmp_file: !!null
- name: Create a test image file
ansible.builtin.tempfile:
register: tmp_file
- name: Fill test image file to 1MB
community.general.filesize:
path: '{{ tmp_file.path }}'
size: 1M
- name: Create test image
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: "{{ test_volume_image }}"
filename: "{{ tmp_file.path }}"
disk_format: raw
tags: "{{ image_tags }}"
- name: Create volume from image
openstack.cloud.volume:
cloud: "{{ cloud }}"
state: present
size: 1
image: "{{ test_volume_image }}"
name: ansible_volume2
description: Test volume
- name: Delete volume from image
openstack.cloud.volume:
cloud: "{{ cloud }}"
name: ansible_volume2
state: absent
- name: Create test shared image
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: "{{ image_name }}"
filename: "{{ tmp_file.path }}"
is_public: true
disk_format: raw
tags: "{{ image_tags }}"
- name: Delete test shared image
openstack.cloud.image:
cloud: "{{ cloud }}"
state: absent
name: "{{ image_name }}"
filename: "{{ tmp_file.path }}"
is_public: true
disk_format: raw
tags: "{{ image_tags }}"
always:
- name: Remove temporary image file
ansible.builtin.file:
path: "{{ tmp_file.path }}"
state: absent
when: tmp_file is defined and 'path' in tmp_file
- include_tasks: volume_info.yml