| 1 | [Unit] |
| 2 | # https://docs.cloud-init.io/en/latest/explanation/boot.html |
| 3 | Description=Cloud-init: Final Stage |
| 4 | After=network-online.target time-sync.target cloud-config.service rc-local.service |
| 5 | After=multi-user.target |
| 6 | Before=apt-daily.service |
| 7 | Wants=network-online.target cloud-config.service |
| 8 | ConditionPathExists=!/etc/cloud/cloud-init.disabled |
| 9 | ConditionKernelCommandLine=!cloud-init=disabled |
| 10 | ConditionEnvironment=!KERNEL_CMDLINE=cloud-init=disabled |
| 11 | |
| 12 | |
| 13 | [Service] |
| 14 | Type=oneshot |
| 15 | # This service is a shim which preserves systemd ordering while allowing a |
| 16 | # single Python process to run cloud-init's logic. This works by communicating |
| 17 | # with the cloud-init process over a unix socket to tell the process that this |
| 18 | # stage can start, and then wait on a return socket until the cloud-init |
| 19 | # process has completed this stage. The output from the return socket is piped |
| 20 | # into a shell so that the process can send a completion message (defaults to |
| 21 | # "done", otherwise includes an error message) and an exit code to systemd. |
| 22 | ExecStart=sh -c 'echo "start" | nc -U /run/cloud-init/share/final.sock | sh' |
| 23 | RemainAfterExit=yes |
| 24 | TimeoutSec=0 |
| 25 | TasksMax=infinity |
| 26 | |
| 27 | # Output needs to appear in instance console output |
| 28 | StandardOutput=journal+console |
| 29 | |
| 30 | [Install] |
| 31 | WantedBy=cloud-init.target |