ansible: lock in docker_build_host role for the arm64 build lane (gandalf)

Provisions the docker engine on [build_hosts] (gandalf) for the native arm64 daily
knoe-db image build → registry.knoe.dev, run via a remote buildx builder. gandalf is
also a k3s_agent, so the role holds iptables FORWARD=ACCEPT to protect k3s pod
networking (docker's containerd coexists with k3s's on separate sockets). Verified
idempotent: --check against gandalf = ok=5, changed=0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
chrisfu 2026-06-21 15:11:08 -07:00
parent 30df7d1c12
commit abc458260c
3 changed files with 50 additions and 0 deletions

View File

@ -24,6 +24,11 @@ gandalf.prole.org
k3s_servers
k3s_agents
# arm64 docker build host(s) for the native daily knoe-db image lane (→ registry.knoe.dev).
# gandalf is also a k3s_agent; the docker_build_host role keeps FORWARD=ACCEPT so k3s is safe.
[build_hosts]
gandalf.prole.org
[linux_hosts]
pi.prole.org
raspberry.prole.org

View File

@ -0,0 +1,10 @@
---
# Provision docker on the arm64 build host(s) — the native arm64 daily-image lane.
# ansible-playbook infrastructure/playbooks/docker_build_host.yml
# Targets the [build_hosts] inventory group (gandalf). Idempotent: re-running re-asserts
# docker + the FORWARD-policy guard, so the build host survives re-imaging.
- name: Provision docker on arm64 build hosts
hosts: build_hosts
become: true
roles:
- docker_build_host

View File

@ -0,0 +1,35 @@
---
# docker_build_host — provision the docker engine on an arm64 build host (e.g. gandalf)
# for the native arm64 daily knoe-db image build (push → registry.knoe.dev). Builds run
# in a remote buildx builder (buildkit container) on this host; the dev workstation only
# orchestrates over ssh.
#
# These hosts double as k3s agents, so docker's own containerd coexists with k3s's
# embedded containerd (separate sockets: /run/containerd vs /run/k3s/containerd). The one
# real hazard is docker flipping the iptables FORWARD policy to DROP, which would sever
# k3s pod networking — so we hold it at ACCEPT. We deliberately let docker manage its own
# NAT/iptables otherwise, because the buildkit container needs outbound for registry pulls.
- name: Install docker engine (docker.io)
ansible.builtin.apt:
name: docker.io
state: present
update_cache: true
- name: Add the ansible user to the docker group (so buildx can drive docker over ssh)
ansible.builtin.user:
name: "{{ ansible_user | default('ansible') }}"
groups: docker
append: true
- name: Ensure docker is enabled and running
ansible.builtin.service:
name: docker
enabled: true
state: started
- name: Hold the iptables FORWARD policy at ACCEPT (protect k3s pod networking from docker)
ansible.builtin.iptables:
chain: FORWARD
policy: ACCEPT
when: "'k3s_agents' in group_names or 'k3s_servers' in group_names"