cloudinit fix for password expiry

This commit is contained in:
2025-03-30 14:03:52 +00:00
parent 15379acbdc
commit 3471cf1819
3 changed files with 4 additions and 10 deletions

View File

@@ -27,6 +27,7 @@ class CreateServerRequest extends Request implements HasBody
'name' => $this->name,
'server_type' => $this->serverType,
'location' => $this->location,
'user_data' => file_get_contents(resource_path('scripts/hetzner-cloudinit.yml')),
];
}

View File

@@ -34,16 +34,6 @@ class WaitForServerToConnect implements ShouldQueue, ShouldBeEncrypted
->execute('echo "Connected"');
if (! $process->isSuccessful()) {
if (str_contains($process->getErrorOutput(), 'Password change required')) {
$newRootPassword = Str::random(24);
Ssh::create('root', $this->server->ipv4 ?? $this->server->ipv6)
->usePassword($this->rootPassword)
->execute('echo "root:'.$newRootPassword.'" | chpasswd');
$this->rootPassword = $newRootPassword;
$this->release(15);
return;
}
logger('root pw: ' . $this->rootPassword);
logger('server not reachable');
logger('exit code' . $process->getExitCode());

View File

@@ -0,0 +1,3 @@
#cloud-config
chpasswd:
expire: false