[Unit] Description=Afterburn Hostname Documentation=https://coreos.github.io/afterburn/ # These platforms do not provide the hostname via DHCP # options, thus it needs to be fetched from the metadata # and statically applied on first-boot. ConditionKernelCommandLine=|ignition.platform.id=aliyun ConditionKernelCommandLine=|ignition.platform.id=azure ConditionKernelCommandLine=|ignition.platform.id=azurestack ConditionKernelCommandLine=|ignition.platform.id=digitalocean ConditionKernelCommandLine=|ignition.platform.id=exoscale ConditionKernelCommandLine=|ignition.platform.id=hetzner ConditionKernelCommandLine=|ignition.platform.id=ibmcloud ConditionKernelCommandLine=|ignition.platform.id=kubevirt ConditionKernelCommandLine=|ignition.platform.id=proxmoxve ConditionKernelCommandLine=|ignition.platform.id=scaleway ConditionKernelCommandLine=|ignition.platform.id=vultr # We order this service after sysroot has been mounted # but before ignition-files stage has run, so ignition can # overwrite the configured hostname with e.g. a static one # Also order after ignition-remount-sysroot just for # safety for systems that mount /sysroot ro After=initrd-root-fs.target Before=ignition-files.service OnFailure=emergency.target OnFailureJobMode=isolate [Service] ExecStart=/usr/bin/afterburn --cmdline --hostname=/sysroot/etc/hostname # Add hack to mark the file as needing relabelling, as the hostname # file dropped by afterburn will be unlabelled causing SELinux denials. # see: https://github.com/coreos/ignition/issues/635 ExecStart=/bin/sh -c 'mkdir -p /run/tmpfiles.d' ExecStart=/bin/sh -c 'echo "z /etc/hostname - - -" > /run/tmpfiles.d/hostname-relabel.conf' Type=oneshot RemainAfterExit=yes