## template:jinja
[Unit]
Description=Initial cloud-init job (metadata service crawler)
{% if variant not in ["photon"] %}
DefaultDependencies=no
{% endif %}
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 ["almalinux", "centos", "cloudlinux", "eurolinux", "fedora",
                  "miraclelinux", "openEuler", "rhel", "rocky", "virtuozzo"] %}
After=network.service
After=NetworkManager.service
{% endif %}
{% if variant in ["suse"] %}
After=wicked.service
# setting hostname via hostnamectl depends on dbus, which otherwise
# would not be guaranteed at this point.
After=dbus.service
{% endif %}
Before=network-online.target
Before=sshd-keygen.service
Before=sshd.service
{% if variant in ["ubuntu", "unknown", "debian"] %}
Before=sysinit.target
Before=shutdown.target
Conflicts=shutdown.target
{% endif %}
{% if variant in ["suse"] %}
Before=shutdown.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
