summaryrefslogtreecommitdiff
path: root/systemd/cloud-init.service.tmpl
blob: 1b1f9a861de91698746cc9f5bd402636f9bcd4a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
## template:jinja
[Unit]
Description=Initial cloud-init job (metadata service crawler)
{% if variant not in ["photon", "rhel"] %}
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", "OpenCloudOS", "openmandriva", "rhel", "rocky",
                  "suse", "TencentOS", "virtuozzo"] %}

After=network.service
After=NetworkManager.service
After=NetworkManager-wait-online.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
{% if variant == "rhel" %}
ConditionPathExists=!/etc/cloud/cloud-init.disabled
ConditionKernelCommandLine=!cloud-init=disabled
{% endif %}

[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