Skip to content

Commit 2aee391

Browse files
committed
support raid root disks in stackhpc-built images
1 parent 919a7e2 commit 2aee391

File tree

7 files changed

+46
-0
lines changed

7 files changed

+46
-0
lines changed

ansible/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,5 @@ roles/*
9898
!roles/eessi/**
9999
!roles/topology/
100100
!roles/topology/**
101+
!roles/raid/
102+
!roles/raid/**

ansible/extras.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
- hosts: raid
2+
become: yes
3+
gather_facts: no
4+
tags: raid
5+
name: Configure image for baremetal software raid root disks
6+
tasks:
7+
- include_role:
8+
name: raid
9+
110
- hosts: k3s_server:!builder
211
become: yes
312
tags: k3s

ansible/roles/raid/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# raid
2+
3+
Configure an image to support software raid (via [mdadm](https://github.com/md-raid-utilities/mdadm)).
4+
5+
RockyLinux genericcloud images already have the necessary `mdraid` dracut
6+
module installed, as well as kernel modules for `raid0`, `raikd1`, `raid10` and
7+
`raid456` [^1]. This covers all raid modes [supported by Ironic](https://docs.openstack.org/ironic/latest/admin/raid.html#software-raid)
8+
hence this role does not support extending this.
9+
10+
This role changes the command line for the current kernel. It does not reboot
11+
the instance so generally is only useful during image builds.
12+
13+
[^1]: As shown by `lsinitrd /boot/initramfs-$(uname -r).img | grep raid`

ansible/roles/raid/tasks/main.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
- name: Enable autoassembly of mdraid devices
2+
# adds rd.auto=1 - see `man dracut.cmdline`
3+
ansible.builtin.lineinfile:
4+
path: /etc/default/grub
5+
regexp: '^GRUB_CMDLINE_LINUX_DEFAULT="((?:(?!rd.auto=1).)*?)"$'
6+
line: 'GRUB_CMDLINE_LINUX_DEFAULT="\1 rd.auto=1"'
7+
backup: true
8+
backrefs: true
9+
register: update_grub
10+
11+
- name: Update GRUB configuration file
12+
command: grub2-mkconfig -o /boot/grub2/grub.cfg --update-bls-cmdline
13+
when: update_grub.changed

environments/.stackhpc/inventory/extra_groups

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,7 @@ cluster
5050

5151
[compute_init:children]
5252
compute
53+
54+
[raid:children]
55+
# Configure fatimage for raid
56+
builder

environments/common/inventory/groups

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,5 @@ extra_packages
218218
# pulp_host ansible_host=<VM-ip-address>
219219
# Note the host name can't conflict with group names i.e can't be called `pulp` or `pulp_server`
220220

221+
[raid]
222+
# Add `builder` to configure image for software raid

environments/site/inventory/groups

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,6 @@ compute
166166
# separately from the appliance. e.g
167167
# pulp_host ansible_host=<VM-ip-address>
168168
# Note inventory host name cannot conflict with group names i.e can't be called `pulp` or `pulp_server`.
169+
170+
[raid]
171+
# Add `builder` to configure image for software raid

0 commit comments

Comments
 (0)