Files
ansible-collections-openstack/ci/roles/volume/tasks/main.yml
Jakob Meng a8f6dbd904 Renamed image->image_name and flavor->flavor_name to avoid collisions
Change-Id: I09a133b5c4f6c71e10d274be1c70b7edcce1c83c
2022-11-08 20:44:02 +01:00

100 lines
2.3 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
- 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: ansible_image
filename: "{{ tmp_file.path }}"
is_public: true
disk_format: raw
- name: Delete test shared image
openstack.cloud.image:
cloud: "{{ cloud }}"
state: absent
name: ansible_image
filename: "{{ tmp_file.path }}"
is_public: true
disk_format: raw
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