Skip to content

Commit

Permalink
systemd/system: add oem cloud init service
Browse files Browse the repository at this point in the history
these services, based on the ignition execution result will enable or
not cloudinit based on OEM.

Signed-off-by: Mathieu Tortuyaux <[email protected]>
  • Loading branch information
tormath1 committed Feb 10, 2022
1 parent d9738cf commit c68347d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions systemd/system/enable-oem-cloudinit.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Enable cloudinit

[Service]
Type=oneshot
StandardInput=file:/etc/.ignition-result.json

This comment has been minimized.

Copy link
@jepio

jepio Feb 11, 2022

Member

same question here: where is this coming from?

This comment has been minimized.

Copy link
@tormath1

tormath1 Feb 11, 2022

Author Contributor
ExecCondition=/usr/bin/jq -e '.userConfigProvided == false'
ExecCondition=/usr/bin/jq -e '.provisioningBootID | gsub(\"-\"; \"\") | . == $id' --arg id %b
ExecStart=/usr/bin/systemctl enable --now oem-cloudinit.service
RemainAfterExit=true

[Install]
WantedBy=multi-user.target
11 changes: 11 additions & 0 deletions systemd/system/oem-cloudinit.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Run cloudinit

[Service]
EnvironmentFile=/var/run/ignition.env

This comment has been minimized.

Copy link
@jepio

jepio Feb 11, 2022

Member

where is this file coming from?

Type=oneshot
ExecCondition=/usr/bin/bash -xc 'OEMS=(ec2-compat gce rackspace-onmetal azure cloudsigma packet vmware digitalocean); [[ "$${OEMS[*]}" =~ "${OEM_ID}" ]]'

This comment has been minimized.

Copy link
@pothos

pothos Feb 10, 2022

Member

@tormath1 The OEM ID for ec2 seems to be ec2, for OpenStack it's openstack, for brightbox it's brightbox (from grep oem_id coreos-base/oem-ec2-compat/files/grub-*cfg in coreos-overlay)

This comment has been minimized.

Copy link
@tormath1

tormath1 Feb 10, 2022

Author Contributor

ok thanks, will update consequently.

ExecStart=/usr/bin/coreos-cloudinit --oem="${OEM_ID}"

[Install]
WantedBy=multi-user.target

0 comments on commit c68347d

Please sign in to comment.