Config: Maas 2.9.2 installed via snap
i do the following:
replace /var/snap/maas/current/preseeds/curtin_userdata_custom with one that has a few extra commands, one that fetches a tarball of scripts to run and another that extracts and runs those scripts and a third that cleans up
cat curtin_userdata_custom
#cloud-config
debconf_selections:
maas: |
{{for line in str(curtin_preseed).splitlines()}}
{{line}}
{{endfor}}
late_commands:
01-maas: [wget, '--no-proxy', '{{node_disable_pxe_url}}', '--post-data', '{{node_disable_pxe_data}}', '-O', '/dev/null']
02-fetch_preseed_scripts: ['curtin', 'in-target', '--', 'wget', '--no-proxy', 'https://<SOME_HTTPS_FILESERVER>/preseed/scripts/preseed_scripts.tar', '-P', '/root']
03-run_preseed_scripts: ['curtin', 'in-target', '--', 'sh', '-c', 'cd /root ; tar xvf preseed_scripts.tar ; cd preseed ; for script in `ls *.sh` ; do ./${script} ; done 2>&1 |tee >/root/preseed_done_on_$(date +%Y%m%d-%H%M%S).log']
04-cleanup_preseed: ['curtin', 'in-target', '--', 'sh', '-c', 'cd /root ; rm -rf preseed_scripts.tar preseed']
Those scripts are in a git repo that has a CI/CD job that tars them up and drops them onto the fileserver that all nodes being deployed can reach. The scripts have logic that matches based on simple criteria (hostname, domain name, kernel version, etc) that make whatever changes are needed.
These scripts run at the “end” of deployment within the target flesystem of the machine, prior to it rebooting, so they have 100% access to the system to make needed changes. It’s a hacky (IMHO) way to get around something that should be a feature (being able ot specify the EXACT kernel version, or class (hwe, edge, generic) that I want within maas.