2022-03-03 11:44:45 +00:00
= Create MachineConfigs to Configure RHCOS
2021-09-15 12:51:22 +09:00
2022-03-03 11:44:45 +00:00
== Resources
2021-09-15 12:51:22 +09:00
- [1] https://coreos.github.io/butane/getting-started/[Butane Getting Started]
- [2] https://docs.openshift.com/container-platform/4.8/post_installation_configuration/machine-configuration-tasks.html#installation-special-config-chrony_post-install-machine-configuration-tasks[OCP4 Post Installation Configuration]
2022-03-03 11:44:45 +00:00
== Butane
2021-09-15 12:51:22 +09:00
"Butane (formerly the Fedora CoreOS Config Transpiler) is a tool that consumes a Butane Config and produces an Ignition Config, which is a JSON document that can be given to a Fedora CoreOS machine when it first boots." [1]
Butane is available in a container image, we can pull the latest version locally like so:
----
# Pull the latest release
podman pull quay.io/coreos/butane:release
# Run butane using standard in and standard out
podman run -i --rm quay.io/coreos/butane:release --pretty --strict < your_config.bu > transpiled_config.ign
# Run butane using files.
podman run --rm -v /path/to/your_config.bu:/config.bu:z quay.io/coreos/butane:release --pretty --strict /config.bu > transpiled_config.ign
----
We can create a CLI alias to make running the Butane container much easier like so:
----
alias butane='podman run --rm --tty --interactive \
--security-opt label=disable \
--volume ${PWD}:/pwd --workdir /pwd \
quay.io/coreos/butane:release'
----
For more detailed information on how to structure your Butane file see [1]. Once created you can convert the butane config to an igntion file like so:
----
butane master_chrony_machineconfig.bu -o master_chrony_machineconfig.yaml
butane worker_chrony_machineconfig.bu -o worker_chrony_machineconfig.yaml
----