1 {{- define "machine.userData" -}}
4 {{- if and .userData.name .userData.hashedPassword }}
6 - name: {{ .userData.name }}
8 passwd: {{ .userData.hashedPassword }}
9 sudo: "ALL=(ALL) NOPASSWD:ALL"
10 {{- else if .userData.hashedPassword }}
11 password: {{ .userData.hashedPassword }}
13 chpasswd: {expire: False}
15 fqdn: {{ .userData.fqdn }}
18 - {{ .userData.sshAuthorizedKey }}
20 - path: /var/lib/cloud/scripts/per-instance/set_dhcp_identifier.sh
21 # The IP address assigned to the provisioning NIC will change due to
22 # IPA using the MAC address as the client ID and systemd using a
23 # different ID. Tell systemd to use the MAC as the client ID. We
24 # can't do this in the network data as only the JSON format is
25 # supported by metal3, and the JSON format does not support the
26 # dhcp-identifier field.
32 sed -i -e '/dhcp4: true$/!b' -e 'h;s/\S.*/dhcp-identifier: mac/;H;g' /etc/netplan/50-cloud-init.yaml
34 - path: /var/lib/cloud/scripts/per-instance/set_kernel_cmdline.sh
35 # The "intel_iommu=on iommu=pt" kernel command line is necessary for
42 grub_file=${1:-"/etc/default/grub"}
43 kernel_parameters="intel_iommu=on iommu=pt"
44 sed -i~ "/^GRUB_CMDLINE_LINUX=/{h;s/\(=\".*\)\"/\1 ${kernel_parameters}\"/};\${x;/^$/{s//GRUB_CMDLINE_LINUX=\"${kernel_parameters}\"/;H};x}" "$grub_file"