nixos/cloud-init: order after network-online.target (#44633)

Some modules of cloud-init can cope with a network not immediately
available (notably, the EC2 module), but some others won't retry if
network is not available (notably, the Cloudstack module).
network.target doesn't give much guarantee about the network
availability. Applications not able to start without a fully
configured network should be ordered after network-online.target.

Also see #44573 and #44524.
This commit is contained in:
Vincent Bernat 2018-08-08 00:09:00 +02:00 committed by xeji
parent b35238f909
commit 57840dbffb

View File

@ -104,8 +104,9 @@ in
systemd.services.cloud-init = systemd.services.cloud-init =
{ description = "Initial cloud-init job (metadata service crawler)"; { description = "Initial cloud-init job (metadata service crawler)";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
wants = [ "local-fs.target" "cloud-init-local.service" "sshd.service" "sshd-keygen.service" ]; wants = [ "local-fs.target" "network-online.target" "cloud-init-local.service"
after = [ "local-fs.target" "network.target" "cloud-init-local.service" ]; "sshd.service" "sshd-keygen.service" ];
after = [ "local-fs.target" "network-online.target" "cloud-init-local.service" ];
before = [ "sshd.service" "sshd-keygen.service" ]; before = [ "sshd.service" "sshd-keygen.service" ];
requires = [ "network.target "]; requires = [ "network.target "];
path = path; path = path;
@ -121,8 +122,8 @@ in
systemd.services.cloud-config = systemd.services.cloud-config =
{ description = "Apply the settings specified in cloud-config"; { description = "Apply the settings specified in cloud-config";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
wants = [ "network.target" ]; wants = [ "network-online.target" ];
after = [ "network.target" "syslog.target" "cloud-config.target" ]; after = [ "network-online.target" "syslog.target" "cloud-config.target" ];
path = path; path = path;
serviceConfig = serviceConfig =
@ -137,8 +138,8 @@ in
systemd.services.cloud-final = systemd.services.cloud-final =
{ description = "Execute cloud user/final scripts"; { description = "Execute cloud user/final scripts";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
wants = [ "network.target" ]; wants = [ "network-online.target" ];
after = [ "network.target" "syslog.target" "cloud-config.service" "rc-local.service" ]; after = [ "network-online.target" "syslog.target" "cloud-config.service" "rc-local.service" ];
requires = [ "cloud-config.target" ]; requires = [ "cloud-config.target" ];
path = path; path = path;
serviceConfig = serviceConfig =