feat(ansible): GitLab Runner deployment with Docker socket proxy
Summary
- Extract Docker installation from monolithic
deploy.ymlinto reusableroles/docker(backward-compatible, no behavior change) - Add
roles/docker_socket_proxy— tecnativa/docker-socket-proxy via docker-compose (default-deny API filtering) - Add
roles/gitlab_runner— installs gitlab-runner, deploys config.toml with security hardening (resource limits, cap_drop ALL, no privileged) - Simplify runner registration: manual
glrt-xxxtoken flow instead of API-based registration (GitLab 16+ best practice)
Security
- CI jobs access Docker through the socket proxy, not the raw socket
- Only explicitly allowed API endpoints: CONTAINERS, IMAGES, NETWORKS, VOLUMES, EXEC, POST
- Blocked: SWARM, SECRETS, AUTH, PLUGINS, BUILD, TASKS
- Resource limits: 4g RAM, 2 CPUs per job
-
cap_drop: ALL,privileged: false
Test plan
-
ansible-playbook --syntax-check gitlab-runner.ymlpasses -
Full deployment on 10.0.0.100 succeeds -
Proxy responds on /_ping, can list containers -
Runner service active, connected to GitLab -
CI job runs through proxy with testcontainers -
Verify deploy.ymlstill works unchanged (backward compat)