Ignition is designed to only run at first boot, but running PXE like
you described there is no "first boot" since there is no boot
partition and the rootfs isn't persisted. Every boot looks like a
"first boot", so Ignition runs every time. For those reasons we added
support for reusing existing filesystems[1] and partitions[2] to
Ignition. Unfortunately we haven't implemented LVM support, so you'll
have to roll your own. Luckily, you don't need root on LVM, so that's
not an issue.
Since you're not installing to disk, having Ignition run every boot is
actually what you want. Every time you boot you'll get a blank system,
aside from whatever is not on the rootfs. You don't need to worry
about configuration the previous boot wrote since you'll be starting
fresh every time. This only applies to things on the root filesystem,
data stored on a different filesystem will persist and you'll need to
be able to handle that.
This is how I'd generally go about it:
1) Write a script that sets up the LVM but check if it's already set
up and not perform any actions. Use a CLC/Ignition to install that
script.
2) Write a systemd service unit that calls that script. Use your CLC
to add the unit.
3) Write a systemd mount unit that depends on that script (you'll want
both Requires= and After=) and anything else you need to expose or
start the LVM LV.
I can't go into too much more detail about the LVM bits since I
haven't dug into LVM in detail yet.
- Andrew
[1]
https://coreos.com/ignition/docs/latest/operator-notes.html#filesystem-reuse-semantics
[2]
https://coreos.com/ignition/docs/latest/operator-notes.html#partition-reuse-semantics