2026-02-18 08:24:25 -08:00
|
|
|
---
|
|
|
|
|
- name: Configure ringtail (NixOS)
|
|
|
|
|
hosts: ringtail
|
|
|
|
|
become: true
|
|
|
|
|
|
Add k3s, 1Password Connect, and systemd nix-container-builder to ringtail (#209)
## Summary
Extends ringtail from a desktop/gaming NixOS box into an infrastructure node with a k3s cluster, secrets management, and a Forgejo Actions
runner for building containers with Nix.
### K3s cluster
- Single-node k3s with Traefik/ServiceLB/metrics-server disabled (minimal footprint)
- TLS SAN set to `ringtail.tail8d86e.ts.net` so ArgoCD on indri can manage it via Tailscale
- Containerd registry mirrors pull through Zot on indri (`k3s-registries.yaml`)
- Tailscale interface added to `trustedInterfaces` for cross-node ArgoCD access
- `kubectl` added to system packages
### 1Password Connect + External Secrets Operator
- Four new ArgoCD apps targeting `k3s-ringtail`: `1password-connect-ringtail`, `external-secrets-crds-ringtail`, `external-secrets-ringtail`,
`external-secrets-config-ringtail`
- Reuses the same Helm charts/values as indri, just pointed at ringtail's k3s API server
- Bootstrap secrets (`op-credentials`, `onepassword-token`) provisioned by Ansible pre_tasks via `op read`, then applied to the `1password`
namespace in post_tasks
### Systemd Forgejo Actions runner
- Native `services.gitea-actions-runner` with `forgejo-runner` package — no DinD, no k8s pod, runs directly on the NixOS host
- Label `nix-container-builder:host` — jobs execute on the host with `nix`, `skopeo`, `nodejs`, etc. in PATH
- Registration token fetched from 1Password (`Forgejo Secrets/runner_reg`) by Ansible and written to `/etc/forgejo-runner/token.env`
- Runner's dynamic user (`gitea-runner`) added to `nix.settings.trusted-users` for nix daemon access
### Nix container build workflow
- New `.forgejo/workflows/build-container-nix.yaml` triggers on `*-nix-v[0-9]*` tags (e.g. `nettest-nix-v1.0.0`)
- Builds with `nix build -f containers/<name>/default.nix`, pushes to Zot via `skopeo copy`
- Existing Dockerfile workflow guarded with `if: !contains(github.ref_name, '-nix-v')` to avoid double-triggering
### Mise task updates
- `container-tag-and-release` auto-detects `default.nix` vs `Dockerfile` and uses the appropriate tag format (`-nix-v` vs `-v`)
- `container-list` shows build type indicator (`[nix]` / `[dockerfile]`)
## Post-merge
1. `mise run provision-ringtail` — deploys k3s token, runner token, NixOS rebuild
2. Register k3s cluster in ArgoCD (first time only):
```fish
ssh ringtail 'sudo cat /etc/rancher/k3s/k3s.yaml' | \
sed 's|127.0.0.1|ringtail.tail8d86e.ts.net|' > /tmp/k3s-ringtail.yaml
set -x KUBECONFIG /tmp/k3s-ringtail.yaml
argocd cluster add default --name k3s-ringtail
3. Sync ArgoCD apps in order: 1password-connect-ringtail -> external-secrets-crds-ringtail -> external-secrets-ringtail ->
external-secrets-config-ringtail
4. Verify runner: ssh ringtail 'systemctl status gitea-runner-nix-container-builder'
5. Check Forgejo admin panel for ringtail-nix-builder runner online
6. Test: create containers/<name>/default.nix, tag with <name>-nix-v0.1.0
Reviewed-on: https://forge.ops.eblu.me/eblume/blumeops/pulls/209
2026-02-18 21:15:30 -08:00
|
|
|
pre_tasks:
|
|
|
|
|
- name: Fetch 1Password Connect credentials from 1Password
|
|
|
|
|
ansible.builtin.command:
|
|
|
|
|
cmd: op read "op://vg6xf6vvfmoh5hqjjhlhbeoaie/1Password Connect/credentials-file"
|
|
|
|
|
register: _op_credentials
|
|
|
|
|
changed_when: false
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
become: false
|
|
|
|
|
|
|
|
|
|
- name: Fetch 1Password Connect token from 1Password
|
|
|
|
|
ansible.builtin.command:
|
|
|
|
|
cmd: op read "op://vg6xf6vvfmoh5hqjjhlhbeoaie/1Password Connect/token"
|
|
|
|
|
register: _op_token
|
|
|
|
|
changed_when: false
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
become: false
|
|
|
|
|
|
|
|
|
|
- name: Fetch Forgejo runner registration token from 1Password
|
|
|
|
|
ansible.builtin.command:
|
|
|
|
|
cmd: op read "op://vg6xf6vvfmoh5hqjjhlhbeoaie/Forgejo Secrets/runner_reg"
|
|
|
|
|
register: _runner_reg
|
|
|
|
|
changed_when: false
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
become: false
|
|
|
|
|
|
|
|
|
|
- name: Ensure /etc/forgejo-runner directory exists
|
|
|
|
|
ansible.builtin.file:
|
|
|
|
|
path: /etc/forgejo-runner
|
|
|
|
|
state: directory
|
|
|
|
|
mode: "0700"
|
|
|
|
|
|
|
|
|
|
- name: Write Forgejo runner token file
|
|
|
|
|
ansible.builtin.copy:
|
|
|
|
|
content: "TOKEN={{ _runner_reg.stdout }}"
|
|
|
|
|
dest: /etc/forgejo-runner/token.env
|
|
|
|
|
mode: "0600"
|
|
|
|
|
no_log: true
|
|
|
|
|
|
|
|
|
|
- name: Ensure /etc/k3s directory exists
|
|
|
|
|
ansible.builtin.file:
|
|
|
|
|
path: /etc/k3s
|
|
|
|
|
state: directory
|
|
|
|
|
mode: "0700"
|
|
|
|
|
|
|
|
|
|
- name: Generate k3s token if not present
|
|
|
|
|
ansible.builtin.copy:
|
|
|
|
|
content: "{{ lookup('ansible.builtin.password', '/dev/null', chars=['hexdigits'], length=32) }}"
|
|
|
|
|
dest: /etc/k3s/token
|
|
|
|
|
mode: "0600"
|
|
|
|
|
force: false
|
|
|
|
|
|
2026-02-18 08:24:25 -08:00
|
|
|
tasks:
|
|
|
|
|
- name: Ensure blumeops repo is present
|
|
|
|
|
ansible.builtin.git:
|
|
|
|
|
repo: "https://forge.ops.eblu.me/eblume/blumeops.git"
|
|
|
|
|
dest: /etc/blumeops
|
Polish ringtail NixOS config and add documentation (#208)
## Summary
- Fix Super+Return keybinding to launch wezterm in sway
- Set fish as default login shell
- Remove `initialPassword` (real password already set)
- Add 1Password CLI + GUI, chezmoi, and dev tool packages (neovim, eza, fd, fzf, zoxide, starship, atuin, bat, ripgrep)
- Add ringtail reference card, update host inventory and reference index
- Changelog fragment
## Post-merge deployment
- `mise run provision-ringtail` to rebuild NixOS
- On ringtail: launch 1Password GUI, enable CLI integration (Settings > Developer > CLI integration)
- Chezmoi needs `.chezmoiignore` updates in the dotfiles repo (separate task)
Reviewed-on: https://forge.ops.eblu.me/eblume/blumeops/pulls/208
2026-02-18 17:53:47 -08:00
|
|
|
version: "{{ ringtail_commit | default('main') }}"
|
2026-02-18 09:32:23 -08:00
|
|
|
force: true
|
2026-02-18 08:24:25 -08:00
|
|
|
register: _repo
|
|
|
|
|
|
|
|
|
|
- name: Rebuild NixOS
|
|
|
|
|
ansible.builtin.command:
|
|
|
|
|
cmd: nixos-rebuild switch --flake /etc/blumeops/nixos/ringtail#ringtail
|
|
|
|
|
register: _rebuild
|
Polish ringtail NixOS config and add documentation (#208)
## Summary
- Fix Super+Return keybinding to launch wezterm in sway
- Set fish as default login shell
- Remove `initialPassword` (real password already set)
- Add 1Password CLI + GUI, chezmoi, and dev tool packages (neovim, eza, fd, fzf, zoxide, starship, atuin, bat, ripgrep)
- Add ringtail reference card, update host inventory and reference index
- Changelog fragment
## Post-merge deployment
- `mise run provision-ringtail` to rebuild NixOS
- On ringtail: launch 1Password GUI, enable CLI integration (Settings > Developer > CLI integration)
- Chezmoi needs `.chezmoiignore` updates in the dotfiles repo (separate task)
Reviewed-on: https://forge.ops.eblu.me/eblume/blumeops/pulls/208
2026-02-18 17:53:47 -08:00
|
|
|
changed_when: "'activating the configuration' in _rebuild.stderr"
|
2026-02-18 08:24:25 -08:00
|
|
|
when: _repo.changed
|
|
|
|
|
|
|
|
|
|
- name: Verify tailscale is connected
|
|
|
|
|
ansible.builtin.command: tailscale status --self --json
|
|
|
|
|
register: _ts_status
|
|
|
|
|
changed_when: false
|
|
|
|
|
failed_when: "'Running' not in _ts_status.stdout"
|
Add k3s, 1Password Connect, and systemd nix-container-builder to ringtail (#209)
## Summary
Extends ringtail from a desktop/gaming NixOS box into an infrastructure node with a k3s cluster, secrets management, and a Forgejo Actions
runner for building containers with Nix.
### K3s cluster
- Single-node k3s with Traefik/ServiceLB/metrics-server disabled (minimal footprint)
- TLS SAN set to `ringtail.tail8d86e.ts.net` so ArgoCD on indri can manage it via Tailscale
- Containerd registry mirrors pull through Zot on indri (`k3s-registries.yaml`)
- Tailscale interface added to `trustedInterfaces` for cross-node ArgoCD access
- `kubectl` added to system packages
### 1Password Connect + External Secrets Operator
- Four new ArgoCD apps targeting `k3s-ringtail`: `1password-connect-ringtail`, `external-secrets-crds-ringtail`, `external-secrets-ringtail`,
`external-secrets-config-ringtail`
- Reuses the same Helm charts/values as indri, just pointed at ringtail's k3s API server
- Bootstrap secrets (`op-credentials`, `onepassword-token`) provisioned by Ansible pre_tasks via `op read`, then applied to the `1password`
namespace in post_tasks
### Systemd Forgejo Actions runner
- Native `services.gitea-actions-runner` with `forgejo-runner` package — no DinD, no k8s pod, runs directly on the NixOS host
- Label `nix-container-builder:host` — jobs execute on the host with `nix`, `skopeo`, `nodejs`, etc. in PATH
- Registration token fetched from 1Password (`Forgejo Secrets/runner_reg`) by Ansible and written to `/etc/forgejo-runner/token.env`
- Runner's dynamic user (`gitea-runner`) added to `nix.settings.trusted-users` for nix daemon access
### Nix container build workflow
- New `.forgejo/workflows/build-container-nix.yaml` triggers on `*-nix-v[0-9]*` tags (e.g. `nettest-nix-v1.0.0`)
- Builds with `nix build -f containers/<name>/default.nix`, pushes to Zot via `skopeo copy`
- Existing Dockerfile workflow guarded with `if: !contains(github.ref_name, '-nix-v')` to avoid double-triggering
### Mise task updates
- `container-tag-and-release` auto-detects `default.nix` vs `Dockerfile` and uses the appropriate tag format (`-nix-v` vs `-v`)
- `container-list` shows build type indicator (`[nix]` / `[dockerfile]`)
## Post-merge
1. `mise run provision-ringtail` — deploys k3s token, runner token, NixOS rebuild
2. Register k3s cluster in ArgoCD (first time only):
```fish
ssh ringtail 'sudo cat /etc/rancher/k3s/k3s.yaml' | \
sed 's|127.0.0.1|ringtail.tail8d86e.ts.net|' > /tmp/k3s-ringtail.yaml
set -x KUBECONFIG /tmp/k3s-ringtail.yaml
argocd cluster add default --name k3s-ringtail
3. Sync ArgoCD apps in order: 1password-connect-ringtail -> external-secrets-crds-ringtail -> external-secrets-ringtail ->
external-secrets-config-ringtail
4. Verify runner: ssh ringtail 'systemctl status gitea-runner-nix-container-builder'
5. Check Forgejo admin panel for ringtail-nix-builder runner online
6. Test: create containers/<name>/default.nix, tag with <name>-nix-v0.1.0
Reviewed-on: https://forge.ops.eblu.me/eblume/blumeops/pulls/209
2026-02-18 21:15:30 -08:00
|
|
|
|
|
|
|
|
post_tasks:
|
|
|
|
|
- name: Wait for k3s to be ready
|
|
|
|
|
ansible.builtin.command: k3s kubectl get nodes
|
|
|
|
|
register: _k3s_ready
|
|
|
|
|
changed_when: false
|
|
|
|
|
retries: 30
|
|
|
|
|
delay: 5
|
|
|
|
|
until: _k3s_ready.rc == 0
|
|
|
|
|
|
|
|
|
|
- name: Create 1password namespace
|
|
|
|
|
ansible.builtin.command: k3s kubectl create namespace 1password
|
|
|
|
|
register: _ns
|
|
|
|
|
changed_when: _ns.rc == 0
|
|
|
|
|
failed_when: _ns.rc != 0 and 'AlreadyExists' not in _ns.stderr
|
|
|
|
|
|
|
|
|
|
- name: Create or update op-credentials secret
|
|
|
|
|
ansible.builtin.shell:
|
|
|
|
|
cmd: |
|
|
|
|
|
set -o pipefail
|
|
|
|
|
k3s kubectl create secret generic op-credentials \
|
|
|
|
|
--namespace=1password \
|
|
|
|
|
--from-literal=1password-credentials.json='{{ _op_credentials.stdout }}' \
|
|
|
|
|
--dry-run=client -o yaml | k3s kubectl apply -f -
|
|
|
|
|
executable: /run/current-system/sw/bin/bash
|
|
|
|
|
changed_when: true
|
|
|
|
|
no_log: true
|
|
|
|
|
|
|
|
|
|
- name: Create or update onepassword-token secret
|
|
|
|
|
ansible.builtin.shell:
|
|
|
|
|
cmd: |
|
|
|
|
|
set -o pipefail
|
|
|
|
|
k3s kubectl create secret generic onepassword-token \
|
|
|
|
|
--namespace=1password \
|
|
|
|
|
--from-literal=token={{ _op_token.stdout }} \
|
|
|
|
|
--dry-run=client -o yaml | k3s kubectl apply -f -
|
|
|
|
|
executable: /run/current-system/sw/bin/bash
|
|
|
|
|
changed_when: true
|
|
|
|
|
no_log: true
|