Install and start a service on Fedora Core OS using Ignition

I use Terraform to setup Fedora CoreOS VMs in vSphere, and for Terraform to finish VMware tools has to be running so the VM’s IP-address can be discovered and returned via the vSphere API to Terraform.

To accomplish this on Fedora CoreOS using Ignition I use this service unit in systemd.

[Unit]
Description=Layer open-vm-tools with rpm-ostree
Wants=network-online.target
After=network-online.target
Before=zincati.service
ConditionPathExists=!/var/lib/%N.stamp

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/rpm-ostree install --apply-live --allow-inactive open-vm-tools
ExecStart=/bin/touch /var/lib/%N.stamp
ExecStartPost=/usr/bin/systemctl enable --now vmtoolsd.service

[Install]
WantedBy=multi-user.target

Most of this is taken from the official documentation but I’ve added systemctl enable --now vmtoolsd.service because this is not enabled by default when you layer the package.

See also