summaryrefslogtreecommitdiff
path: root/systemd/cloud-init.service.tmpl
diff options
context:
space:
mode:
authorRyan Harper <ryan.harper@canonical.com>2017-06-13 09:06:41 -0500
committerScott Moser <smoser@brickies.net>2017-07-19 17:52:32 -0400
commitdcbe479575fac9f293c5c4089f4bcb46ab887206 (patch)
tree43fbeea7110338747135af20f9b702200f7c2607 /systemd/cloud-init.service.tmpl
parent97abd83513bee191b58f095f4d683b18acce0b49 (diff)
downloadvyos-cloud-init-dcbe479575fac9f293c5c4089f4bcb46ab887206.tar.gz
vyos-cloud-init-dcbe479575fac9f293c5c4089f4bcb46ab887206.zip
Templatize systemd unit files for cross distro deltas.
Under el7, cloud-init systemd files need some unit tweaks to ensure they run at the right time. Pull in current el7 downstream systemd unit changes.
Diffstat (limited to 'systemd/cloud-init.service.tmpl')
-rw-r--r--systemd/cloud-init.service.tmpl35
1 files changed, 35 insertions, 0 deletions
diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl
new file mode 100644
index 00000000..2c71889d
--- /dev/null
+++ b/systemd/cloud-init.service.tmpl
@@ -0,0 +1,35 @@
+## template:jinja
+[Unit]
+Description=Initial cloud-init job (metadata service crawler)
+DefaultDependencies=no
+Wants=cloud-init-local.service
+Wants=sshd-keygen.service
+Wants=sshd.service
+After=cloud-init-local.service
+After=systemd-networkd-wait-online.service
+{% if variant in ["ubuntu", "unknown", "debian"] %}
+After=networking.service
+{% endif %}
+{% if variant in ["centos", "fedora", "redhat"] %}
+After=network.service
+{% endif %}
+Before=network-online.target
+Before=sshd-keygen.service
+Before=sshd.service
+{% if variant in ["ubuntu", "unknown", "debian"] %}
+Before=sysinit.target
+Conflicts=shutdown.target
+{% endif %}
+Before=systemd-user-sessions.service
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/cloud-init init
+RemainAfterExit=yes
+TimeoutSec=0
+
+# Output needs to appear in instance console output
+StandardOutput=journal+console
+
+[Install]
+WantedBy=cloud-init.target