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.

authored by

Vincent Bernat and committed by
xeji
57840dbf b35238f9

+7 -6
+7 -6
nixos/modules/services/system/cloud-init.nix
··· 104 systemd.services.cloud-init = 105 { description = "Initial cloud-init job (metadata service crawler)"; 106 wantedBy = [ "multi-user.target" ]; 107 - wants = [ "local-fs.target" "cloud-init-local.service" "sshd.service" "sshd-keygen.service" ]; 108 - after = [ "local-fs.target" "network.target" "cloud-init-local.service" ]; 109 before = [ "sshd.service" "sshd-keygen.service" ]; 110 requires = [ "network.target "]; 111 path = path; ··· 121 systemd.services.cloud-config = 122 { description = "Apply the settings specified in cloud-config"; 123 wantedBy = [ "multi-user.target" ]; 124 - wants = [ "network.target" ]; 125 - after = [ "network.target" "syslog.target" "cloud-config.target" ]; 126 127 path = path; 128 serviceConfig = ··· 137 systemd.services.cloud-final = 138 { description = "Execute cloud user/final scripts"; 139 wantedBy = [ "multi-user.target" ]; 140 - wants = [ "network.target" ]; 141 - after = [ "network.target" "syslog.target" "cloud-config.service" "rc-local.service" ]; 142 requires = [ "cloud-config.target" ]; 143 path = path; 144 serviceConfig =
··· 104 systemd.services.cloud-init = 105 { description = "Initial cloud-init job (metadata service crawler)"; 106 wantedBy = [ "multi-user.target" ]; 107 + wants = [ "local-fs.target" "network-online.target" "cloud-init-local.service" 108 + "sshd.service" "sshd-keygen.service" ]; 109 + after = [ "local-fs.target" "network-online.target" "cloud-init-local.service" ]; 110 before = [ "sshd.service" "sshd-keygen.service" ]; 111 requires = [ "network.target "]; 112 path = path; ··· 122 systemd.services.cloud-config = 123 { description = "Apply the settings specified in cloud-config"; 124 wantedBy = [ "multi-user.target" ]; 125 + wants = [ "network-online.target" ]; 126 + after = [ "network-online.target" "syslog.target" "cloud-config.target" ]; 127 128 path = path; 129 serviceConfig = ··· 138 systemd.services.cloud-final = 139 { description = "Execute cloud user/final scripts"; 140 wantedBy = [ "multi-user.target" ]; 141 + wants = [ "network-online.target" ]; 142 + after = [ "network-online.target" "syslog.target" "cloud-config.service" "rc-local.service" ]; 143 requires = [ "cloud-config.target" ]; 144 path = path; 145 serviceConfig =