Compare commits
6 Commits
stage
...
15e6471e7e
| Author | SHA1 | Date | |
|---|---|---|---|
| 15e6471e7e | |||
| e9bac70cae | |||
| 97295a7071 | |||
| 6ca189b32c | |||
| 2aa9950f59 | |||
| c1f86483ad |
@@ -27,7 +27,7 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: https://gitea.com/actions/checkout@v4
|
||||
|
||||
- name: Create SSH key
|
||||
run: |
|
||||
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: https://gitea.com/actions/checkout@v4
|
||||
|
||||
- name: Create SSH key
|
||||
run: |
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: https://gitea.com/actions/checkout@v4
|
||||
|
||||
- name: Create secrets.tfvars
|
||||
working-directory: terraform
|
||||
|
||||
@@ -36,7 +36,7 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: https://gitea.com/actions/checkout@v4
|
||||
|
||||
- name: Create Terraform secret files
|
||||
working-directory: terraform
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: https://gitea.com/actions/checkout@v4
|
||||
|
||||
- name: Create secrets.tfvars
|
||||
working-directory: terraform
|
||||
|
||||
@@ -110,9 +110,7 @@ class Controller:
|
||||
"-o",
|
||||
"IdentitiesOnly=yes",
|
||||
"-o",
|
||||
"StrictHostKeyChecking=no",
|
||||
"-o",
|
||||
"UserKnownHostsFile=/dev/null",
|
||||
"StrictHostKeyChecking=accept-new",
|
||||
"-i",
|
||||
self.ssh_key,
|
||||
]
|
||||
@@ -147,13 +145,7 @@ class Controller:
|
||||
f"({attempt}/{self.ssh_ready_retries})"
|
||||
)
|
||||
time.sleep(self.ssh_ready_delay)
|
||||
raise RuntimeError(
|
||||
"Unable to authenticate to "
|
||||
f"{ip} with users: {', '.join(self.ssh_candidates)}. "
|
||||
"If this is a freshly cloned VM, the Proxmox source template likely does not yet include the "
|
||||
"current cloud-init-capable NixOS template configuration from nixos/template-base. "
|
||||
"Terraform can only clone what exists in Proxmox; it cannot retrofit cloud-init support into an old template."
|
||||
)
|
||||
raise RuntimeError(f"Unable to authenticate to {ip} with users: {', '.join(self.ssh_candidates)}")
|
||||
|
||||
def remote(self, ip, cmd, check=True):
|
||||
ordered = [self.active_ssh_user] + [u for u in self.ssh_candidates if u != self.active_ssh_user]
|
||||
@@ -174,7 +166,14 @@ class Controller:
|
||||
return last
|
||||
|
||||
def prepare_known_hosts(self):
|
||||
pass
|
||||
ssh_dir = Path.home() / ".ssh"
|
||||
ssh_dir.mkdir(parents=True, exist_ok=True)
|
||||
(ssh_dir / "known_hosts").touch()
|
||||
run_local(["chmod", "700", str(ssh_dir)])
|
||||
run_local(["chmod", "600", str(ssh_dir / "known_hosts")])
|
||||
for ip in self.node_ips.values():
|
||||
run_local(["ssh-keygen", "-R", ip], check=False)
|
||||
run_local(f"ssh-keyscan -H {shlex.quote(ip)} >> {shlex.quote(str(ssh_dir / 'known_hosts'))}", check=False)
|
||||
|
||||
def prepare_remote_nix(self, ip):
|
||||
self.remote(ip, "sudo mkdir -p /etc/nix")
|
||||
|
||||
@@ -10,7 +10,7 @@ in
|
||||
./hardware-configuration.nix;
|
||||
|
||||
networking.hostName = "k8s-base-template";
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
networking.useDHCP = false;
|
||||
networking.useNetworkd = true;
|
||||
networking.nameservers = [ "1.1.1.1" "8.8.8.8" ];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user