fix: runner DNS resolution and stale registration (#7)

## Summary
- Fix `etc_hosts` templating — dict key was rendered as literal `{{ server_fqdn.value }}` instead of the actual domain
- Clear runner data volume on each deploy to prevent stale registration errors when the token changes
- Use instance-level registration token for global runner access

## Test plan
- [x] `/etc/hosts` in runner container shows `git.maximhutz.com` mapped to `10.0.1.2`
- [x] Runner registers and connects successfully
- [ ] Verify runner picks up jobs from any repo

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Reviewed-on: #7
Co-authored-by: M.V. Hutz <git@maximhutz.me>
Co-committed-by: M.V. Hutz <git@maximhutz.me>
This commit was merged in pull request #7.
This commit is contained in:
2026-03-16 02:00:54 +00:00
committed by Maxim Hutz
parent 04ca230bee
commit 3f724dbdfd
2 changed files with 80 additions and 75 deletions

View File

@@ -96,8 +96,14 @@
- ../vault.yml
- ../dist/terraform_outputs.yml
vars:
gitea_internal_url: "https://{{ server_fqdn.value }}"
gitea_hostname: "{{ server_fqdn.value }}"
gitea_internal_url: "https://{{ gitea_hostname }}"
tasks:
- name: Remove stale runner data.
community.docker.docker_volume:
name: runner-data
state: absent
- name: Create runner data volume.
community.docker.docker_volume:
name: runner-data
@@ -118,8 +124,7 @@
state: started
recreate: true
restart_policy: unless-stopped
etc_hosts:
"{{ server_fqdn.value }}": "10.0.1.2"
etc_hosts: "{{ {gitea_hostname: '10.0.1.2'} }}"
volumes:
- runner-data:/data
- /var/run/docker.sock:/var/run/docker.sock