diff --git a/ansible/.gitignore b/ansible/.gitignore index 62c9a543c..b5b3572af 100644 --- a/ansible/.gitignore +++ b/ansible/.gitignore @@ -98,3 +98,5 @@ roles/* !roles/eessi/** !roles/topology/ !roles/topology/** +!roles/raid/ +!roles/raid/** diff --git a/ansible/extras.yml b/ansible/extras.yml index 02b0d402f..3c790be81 100644 --- a/ansible/extras.yml +++ b/ansible/extras.yml @@ -1,4 +1,11 @@ ---- +- hosts: raid + become: true + tags: raid + gather_facts: true + tasks: + - ansible.builtin.include_role: + name: raid + - hosts: k3s_server:!builder become: true tags: k3s diff --git a/ansible/roles/raid/README.md b/ansible/roles/raid/README.md new file mode 100644 index 000000000..4774a467d --- /dev/null +++ b/ansible/roles/raid/README.md @@ -0,0 +1,17 @@ +# raid + +Configure an image to support software raid (via [mdadm](https://github.com/md-raid-utilities/mdadm)). + +RockyLinux genericcloud images already have the necessary `mdraid` dracut +module installed, as well as kernel modules for `raid0`, `raikd1`, `raid10` and +`raid456` [^1]. This covers all raid modes [supported by Ironic](https://docs.openstack.org/ironic/latest/admin/raid.html#software-raid) +hence this role does not support extending this. + +This role changes the command line for the current kernel. It does not reboot +the instance so generally is only useful during image builds. + +Note that the `rootfs_uuid` image property described in the [Ironic raid documentation](https://docs.openstack.org/ironic/latest/admin/raid.html#image-requirements) +is not required; the root partition is the first (non-boot) partition and this +is sufficent for Ironic to find the root file system. + +[^1]: As shown by `lsinitrd /boot/initramfs-$(uname -r).img | grep raid` diff --git a/ansible/roles/raid/handlers/main.yml b/ansible/roles/raid/handlers/main.yml new file mode 100644 index 000000000..02867f7d2 --- /dev/null +++ b/ansible/roles/raid/handlers/main.yml @@ -0,0 +1,3 @@ +- name: Update GRUB configuration file + ansible.builtin.command: "grub2-mkconfig -o /boot/grub2/grub.cfg {{ '--update-bls-cmdline' if ansible_distribution_major_version == '9' else '' }}" + changed_when: true diff --git a/ansible/roles/raid/tasks/main.yml b/ansible/roles/raid/tasks/main.yml new file mode 100644 index 000000000..3ea61dbe4 --- /dev/null +++ b/ansible/roles/raid/tasks/main.yml @@ -0,0 +1,17 @@ +- name: Enable autoassembly of mdraid devices + # adds rd.auto=1 - see `man dracut.cmdline` + ansible.builtin.lineinfile: + path: /etc/default/grub + regexp: > + ^{{ grub_cmdline_var[ansible_distribution_major_version] }}="((?:(?!rd.auto=1).)*?)"$ + line: > + {{ grub_cmdline_var[ansible_distribution_major_version] }}="\1 rd.auto=1" + backup: true + backrefs: true + register: update_grub + notify: + - Update GRUB configuration file + vars: + grub_cmdline_var: + '8': GRUB_CMDLINE_LINUX + '9': GRUB_CMDLINE_LINUX_DEFAULT diff --git a/environments/.stackhpc/inventory/extra_groups b/environments/.stackhpc/inventory/extra_groups index f3a996499..29d9d9378 100644 --- a/environments/.stackhpc/inventory/extra_groups +++ b/environments/.stackhpc/inventory/extra_groups @@ -50,3 +50,7 @@ cluster [compute_init:children] compute + +[raid:children] +# Configure fatimage for raid +builder diff --git a/environments/.stackhpc/tofu/cluster_image.auto.tfvars.json b/environments/.stackhpc/tofu/cluster_image.auto.tfvars.json index bcb56cf84..9650ccd36 100644 --- a/environments/.stackhpc/tofu/cluster_image.auto.tfvars.json +++ b/environments/.stackhpc/tofu/cluster_image.auto.tfvars.json @@ -1,6 +1,6 @@ { "cluster_image": { - "RL8": "openhpc-RL8-250924-1502-e9afbfe5", - "RL9": "openhpc-RL9-250924-1536-e9afbfe5" + "RL8": "openhpc-RL8-250925-1639-62d67ae3", + "RL9": "openhpc-RL9-250925-1639-62d67ae3" } } diff --git a/environments/common/inventory/groups b/environments/common/inventory/groups index ef24952c4..2c67c4a8d 100644 --- a/environments/common/inventory/groups +++ b/environments/common/inventory/groups @@ -217,3 +217,6 @@ extra_packages # separately from the appliance. e.g # pulp_host ansible_host= # Note the host name can't conflict with group names i.e can't be called `pulp` or `pulp_server` + +[raid] +# Add `builder` to configure image for software raid diff --git a/environments/site/inventory/groups b/environments/site/inventory/groups index 930cf9310..85d7e368e 100644 --- a/environments/site/inventory/groups +++ b/environments/site/inventory/groups @@ -169,3 +169,6 @@ compute # separately from the appliance. e.g # pulp_host ansible_host= # Note inventory host name cannot conflict with group names i.e can't be called `pulp` or `pulp_server`. + +[raid] +# Add `builder` to configure image for software raid