Skip to content

Instantly share code, notes, and snippets.

@janeczku
Last active June 8, 2022 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janeczku/1d7ef8391aafe6ffd735f4da8c0a5fa1 to your computer and use it in GitHub Desktop.
Save janeczku/1d7ef8391aafe6ffd735f4da8c0a5fa1 to your computer and use it in GitHub Desktop.
Harvester: Adding a custom systemd unit using oem cloud-config
# Adding the following config stanza to all the Harvester create|join configs will create
# a custom cloud-config `/oem/95_user.yaml` during the (early) "initramfs" cloud-init stage
# of the initial Harvester boot.
# This cloud-config will be executed on each system (re-)boot during the (late) "boot" cloud-init
# stage and may contain any cloud-init directives supported by the cOS Toolkit:
# See https://rancher.github.io/elemental-toolkit/docs/reference/cloud_init/
# Additionally, any files added to the /oem folder in day-2 are persistent and won’t be overwritten
# during Harvester upgrades.
write_files:
- content: |
name: "User Config"
stages:
boot:
- name: "Drop unit file"
files:
- path: /etc/systemd/system/update-ca.service
content: |
[Unit]
Description=Foo
(...)
permissions: 0644
owner: root
group: root
- name: "Enable unit"
systemctl:
enable:
- update-ca
owner: root
path: '/oem/95_user.yaml'
permissions: '0600'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment