mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-05-06 05:13:01 +00:00
Add support for setting volumes to be bootable on creation, as well as support for updating the bootable flag. Closes-Bug: #2137559 Change-Id: I60bac613060551c4d6144675b1553b4fdda2d13d Signed-off-by: James Hewitt <james.hewitt@uk.ibm.com>
121 lines
2.7 KiB
YAML
121 lines
2.7 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 }}"
|
|
|
|
- assert:
|
|
that: not vol.volume.is_bootable
|
|
|
|
- name: Create bootable volume from existing volume
|
|
openstack.cloud.volume:
|
|
cloud: "{{ cloud }}"
|
|
state: present
|
|
size: 1
|
|
volume: "{{ vol.volume.id }}"
|
|
name: ansible_volume1
|
|
is_bootable: true
|
|
description: Test volume
|
|
register: vol
|
|
|
|
- assert:
|
|
that: vol.volume.is_bootable
|
|
|
|
- name: Make the first volume bootable
|
|
openstack.cloud.volume:
|
|
cloud: "{{ cloud }}"
|
|
state: present
|
|
size: 1
|
|
name: ansible_volume
|
|
is_bootable: true
|
|
description: Test volume
|
|
register: vol
|
|
|
|
- assert:
|
|
that: vol.volume.is_bootable
|
|
|
|
- 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
|