CluPilotCloud/config/provisioning.php

57 lines
2.4 KiB
PHP

<?php
use App\Provisioning\Steps\Host;
$wgSubnet = env('CLUPILOT_WG_SUBNET', '10.66.0.0/24');
[$wgNetwork, $wgBits] = array_pad(explode('/', $wgSubnet), 2, '24');
$wgBase = ip2long($wgNetwork) & (0xFFFFFFFF << (32 - (int) $wgBits)) & 0xFFFFFFFF;
$wgHubDefault = long2ip($wgBase + 1); // first usable address in the CIDR
return [
/*
| Ordered step classes per pipeline. ::class is textual — listing steps that
| are built incrementally does not autoload them until the pipeline runs.
*/
'pipelines' => [
'host' => [
Host\ValidateHostInput::class,
Host\EstablishSshTrust::class,
Host\PrepareBaseSystem::class,
Host\ConfigureWireguard::class,
Host\InstallProxmoxVe::class,
Host\RebootIntoPveKernel::class,
Host\ConfigureProxmox::class,
Host\CreateAutomationToken::class,
Host\VerifyProxmoxApi::class,
Host\RegisterCapacity::class,
Host\CompleteHostOnboarding::class,
],
],
// CluPilot VM acts as the WireGuard hub; hosts join it during onboarding.
'wireguard' => [
'subnet' => $wgSubnet,
'hub_ip' => env('CLUPILOT_WG_HUB_IP', $wgHubDefault), // handshake target
'endpoint' => env('CLUPILOT_WG_ENDPOINT', ''), // host:port reachable by peers
'hub_public_key' => env('CLUPILOT_WG_HUB_PUBKEY', ''),
'config_path' => env('CLUPILOT_WG_CONFIG_PATH', '/etc/wireguard/wg0.conf'),
],
// SSH identity CluPilot deploys to each host after first password login.
'ssh' => [
'public_key' => env('CLUPILOT_SSH_PUBLIC_KEY', ''),
'private_key' => env('CLUPILOT_SSH_PRIVATE_KEY', ''),
// Per-command SSH timeout; below the job timeout (2100s) but far above
// the phpseclib ~10s default so apt full-upgrade etc. can finish.
'command_timeout' => (int) env('CLUPILOT_SSH_COMMAND_TIMEOUT', 2000),
],
// Proxmox automation role/user created on each host.
'proxmox' => [
'role_id' => 'CluPilotAutomation',
'role_privs' => 'VM.Allocate,VM.Clone,VM.Config.Disk,VM.Config.CPU,VM.Config.Memory,VM.Config.Network,VM.Config.Options,VM.Config.Cloudinit,VM.PowerMgmt,VM.Monitor,VM.Audit,VM.GuestAgent.Audit,VM.GuestAgent.Unrestricted,Datastore.AllocateSpace,Datastore.Audit,Sys.Audit',
'user' => 'automation@pve',
'token_name' => 'clupilot',
],
];