Files
kolla/roles/configure-ephemeral/tasks/main.yml
Michal Nasiadka af632db5d1 CI: Use ansible-lint for CI roles and playbooks
Removing dbus-python deps because now a-c-k handles that.

Depends-On: https://review.opendev.org/c/openstack/ansible-collection-kolla/+/942179

Change-Id: I97a97da73a7ccb27789e979656867e4adfe8a633
2025-02-20 10:59:30 +00:00

70 lines
2.0 KiB
YAML

---
# On RAX hosts, we have a small root partition and a large,
# unallocated ephemeral device attached at /dev/xvde
- name: Set ephemeral device if /dev/xvde exists
when: ansible_devices["xvde"] is defined
ansible.builtin.set_fact:
ephemeral_device: "/dev/xvde"
# On other providers, we have a device called "ephemeral0".
- name: Set ephemeral device by label
when: ephemeral_device is undefined
block:
- name: Get ephemeral0 device node
ansible.builtin.command: /sbin/blkid -L ephemeral0
register: ephemeral0
# rc !=0 is expected
failed_when: false
changed_when: false
- name: Set ephemeral device if LABEL exists
when: "ephemeral0.rc == 0"
ansible.builtin.set_fact:
ephemeral_device: "{{ ephemeral0.stdout }}"
- name: Configure additional disk (if available)
become: true
when: ephemeral_device is defined
block:
- name: Ensure ephemeral device is unmounted
ansible.posix.mount:
name: "{{ ephemeral_device }}"
state: "{{ item }}"
loop:
- unmounted
- absent
- name: Get existing partitions
community.general.parted:
device: "{{ ephemeral_device }}"
unit: MiB
state: info
register: ephemeral_partitions
- name: Remove any existing partitions
community.general.parted:
device: "{{ ephemeral_device }}"
number: "{{ item.num }}"
state: absent
loop: "{{ ephemeral_partitions.partitions }}"
- name: Create filesystem on additional disk
community.general.filesystem:
fstype: ext4
dev: "{{ ephemeral_device }}"
- name: "Ensure mountpoint {{ configure_ephemeral_mountpoint }}"
ansible.builtin.file:
path: "{{ configure_ephemeral_mountpoint }}"
owner: root
group: root
state: directory
mode: "0755"
- name: Mount additional filesystem
ansible.posix.mount:
path: "{{ configure_ephemeral_mountpoint }}"
src: "{{ ephemeral_device }}"
fstype: ext4
state: mounted