Server Management (Ansible)
Generate the inventory and run the update, hardening, NAT64, and Kubernetes-prerequisite playbooks.
Ansible handles ongoing server management: system updates, security hardening, NAT64 configuration, and Kubernetes prerequisites. All playbooks run from the Dev Container.
Step 1: Set Up Ansible
1.1 Generate inventory
./scripts/generate-ansible-inventory.sh
The inventory (ansible/inventory.ini) is auto-generated. It defines three groups:
control_nodes– all control plane nodesworker_nodes– all worker nodesk8s_cluster– union of control and worker nodes
Warning
Never hand-edit `inventory.ini`. Regenerate after infrastructure changes with `./scripts/generate-ansible-inventory.sh`.1.2 Load SSH keys
source ./scripts/ssh-agent-setup.sh
Important
The ssh-agent must be running with the cluster keys loaded before Ansible can connect. Run `source ./scripts/ssh-agent-setup.sh` in every new terminal session.1.3 Test connectivity
cd ansible
ansible all -m ping
Step 2: Apply System Updates
ansible-playbook playbooks/update-system.yml
Target specific node groups or enable automatic reboots:
# Only control nodes
ansible-playbook playbooks/update-system.yml --limit control_nodes
# With reboot if kernel was updated
ansible-playbook playbooks/update-system.yml -e "reboot_after_update=true"
Step 3: Apply Security Hardening
ansible-playbook playbooks/security-hardening.yml
This enables:
- Unattended upgrades (automatic security updates)
- fail2ban monitoring
- Kernel security parameters (sysctl hardening)
- Secure permissions on sensitive files
- Core dump disabling
Step 4: Configure NAT64/DNS64
For existing nodes that weren’t configured via cloud-init:
ansible-playbook playbooks/configure-nat64.yml
See DNS and NAT64 for details.
Step 5: Install Kubernetes Prerequisites
ansible-playbook playbooks/prepare-k8s-nodes.yml
This installs the selected container runtime, kubeadm, kubelet, and kubectl on
all nodes. The runtime defaults to containerd; pass
-e "container_runtime=cri-o" to use CRI-O instead, matching the
container_runtime variable used by cloud-init.
Next Steps
- Kubernetes (kubeadm) – deploy the cluster
- Ansible Playbooks Reference – detailed playbook documentation