snel.ansible/README.md

53 lines
2.1 KiB
Markdown
Raw Permalink Normal View History

2023-08-28 16:58:46 +02:00
Snel.com Ansible Playbooks
---
2023-10-23 12:18:35 +02:00
## Preparation
Make sure you followed the instructions in [INSTALL.md](./INSTALL.md)
2023-08-28 16:58:46 +02:00
2023-10-23 12:18:35 +02:00
## Step 1: Customer order
Customer orders cluster using the [special order page](https://my.snel.com/cart/kubernetes/)
2023-08-28 18:31:30 +02:00
2023-10-23 12:18:35 +02:00
## Step 2: Create inventory
In this repo:
- Create a copy of the inventory file `inventory/cluster_[NAME].yml.tpl`.
- Replace `[NAME]` with the name of the cluster and remove te `.tpl` suffix.
- Inside this file replace all `[NAME]` and update the IPs
2023-10-23 14:38:26 +02:00
- In the package the customer will have one new Cloud VPS Bucket, this IP is used for the Control Load Balancer `control.[NAME].k8s.snel.com`
2023-10-23 12:18:35 +02:00
- In the package the customer will have 6 new Talos VPSses.
- The first 3 IPs need to be used for the `talos_control_nodes`
- The remaining 3 IPs need to be used for the `talos_worker_nodes`
2023-10-23 14:12:51 +02:00
- Attach 2 extra IPs to the VPS which will become `c1.[NAME].k8s.snel.com`, the first control node.
2023-10-23 12:18:35 +02:00
- Use these IPs in the inventory file as `ingress_ips`
- These will be floating IPs for MetalLB
2023-10-23 14:38:26 +02:00
## Step 3: Make sure you can login on the Control Load Balancer using your SSH key
- Copy your public key to the user created by Hostbill
```bash
PUBLIC_KEY_FILE="${HOME}/.ssh/id_ed25519"
ssh-copy-id -i "${PUBLIC_KEY_FILE}" client_XXXXX_XX@185.62.XXX.XXX
```
- Login as the user created by Hostbill
```bash
ssh client_XXXXX_XX@185.62.XXX.XXX
```
- Copy the public key to root. The sudo password will be asked which, this is the same as the user password from Hostbill.
```bash
sudo bash -c 'mkdir -p /root/.ssh; cat /home/client_*/.ssh/authorized_keys >> /root/.ssh/authorized_keys'
```
## Step 3: Execute playbook - VPSses
2023-10-23 12:18:35 +02:00
Your Vaultwarden vault password will be asked.
2023-08-28 18:31:30 +02:00
```zsh
2023-10-23 12:18:35 +02:00
cd ~/repos/snel.ansible
2023-10-23 14:12:51 +02:00
git pull --recurse-submodules
2023-10-23 12:18:35 +02:00
bw sync
BW_SESSION=$(bw unlock --raw) ansible-playbook site.yml --limit cluster_[NAME]
2023-10-16 20:22:41 +02:00
```
2023-10-23 14:38:26 +02:00
## Execute playbook - (Re)install Talos on Hardware
2023-10-23 12:18:35 +02:00
Your Vaultwarden vault password will be asked.
2023-10-16 20:22:41 +02:00
```zsh
2023-10-23 12:18:35 +02:00
cd ~/repos/snel.ansible
bw sync
BW_SESSION=$(bw unlock --raw) ansible-playbook ./playbooks/snel.kubernetes-cluster/dci_reinstall_talos.yml --limit cluster_[NAME]
2023-08-28 18:31:30 +02:00
```