Skip to content

Commit

Permalink
Merge pull request #60 from flatcar-linux/tormath1/ignition3
Browse files Browse the repository at this point in the history
systemd/system: add oem cloud init service
  • Loading branch information
tormath1 authored Mar 7, 2022
2 parents 5f97a6a + 31f97d7 commit d993da3
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
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
Type=oneshot
ExecCondition=/usr/bin/bash -xc 'OEMS=(aws gce rackspace-onmetal azure cloudsigma packet vmware digitalocean); echo $${OEMS[*]} | tr " " "\n" | grep -q -x -F "${OEM_ID}"'
ExecStart=/usr/bin/bash -xc '/usr/bin/coreos-cloudinit --oem="$(if [ "${OEM_ID}" = aws ]; then echo ec2-compat; else echo "${OEM_ID}" ; fi)"'

[Install]
WantedBy=multi-user.target

0 comments on commit d993da3

Please sign in to comment.