Add Gitea Actions runner, ansible-lint CI, vault setup, and fix group_vars layout

- Move group_vars into inventory/ so playbooks can find them (was only
  visible to ad-hoc commands via CWD)
- Add Ansible Vault for sensitive variables (gitea/grafana passwords,
  tokens, db credentials) with vault_password_file outside the repo
- Enable Gitea Actions and deploy act_runner with Docker backend on
  the gitea VM
- Add .gitea/workflows/lint.yml to run ansible-lint on every push
- Set up Gitea → GitHub push mirror (sync_on_commit)
- Fix ansible.cfg stdout_callback for ansible-core 2.20 compatibility
- Add python-psycopg2 to gitea role (required for postgresql modules)
- Add docker to gitea_runner role (required by act_runner at startup)
- Exclude password hashes and VM images from git

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Adyrem
2026-05-13 17:34:03 +02:00
parent 72d07f49e3
commit 39be9fafe7
25 changed files with 1584 additions and 6 deletions
@@ -0,0 +1,6 @@
---
gitea_runner_version: "0.2.11"
gitea_runner_url: "http://10.10.1.125:3000"
gitea_runner_name: "{{ inventory_hostname }}"
gitea_runner_labels: "native:host"
gitea_runner_registration_token: "{{ vault_gitea_runner_token }}"
@@ -0,0 +1,5 @@
---
- name: Restart act_runner
ansible.builtin.systemd:
name: act_runner
state: restarted
+106
View File
@@ -0,0 +1,106 @@
---
- name: Install act_runner dependencies
community.general.pacman:
name:
- git
- docker
state: present
- name: Enable and start Docker
ansible.builtin.systemd:
name: docker
enabled: true
state: started
- name: Download act_runner binary
ansible.builtin.get_url:
url: "https://dl.gitea.com/act_runner/{{ gitea_runner_version }}/act_runner-{{ gitea_runner_version }}-linux-amd64"
dest: /usr/local/bin/act_runner
mode: "0755"
owner: root
group: root
- name: Create act_runner user
ansible.builtin.user:
name: act_runner
system: true
shell: /sbin/nologin
home: /var/lib/act_runner
create_home: true
groups: docker
append: true
- name: Create act_runner config directory
ansible.builtin.file:
path: /etc/act_runner
state: directory
owner: act_runner
group: act_runner
mode: "0750"
- name: Generate default act_runner config
ansible.builtin.command:
cmd: act_runner generate-config
stdin: ""
register: runner_config_out
changed_when: false
- name: Write act_runner config
ansible.builtin.copy:
content: "{{ runner_config_out.stdout }}"
dest: /etc/act_runner/config.yml
owner: act_runner
group: act_runner
mode: "0640"
force: false
- name: Set runner labels in config
ansible.builtin.replace:
path: /etc/act_runner/config.yml
regexp: '^ labels:$'
replace: " labels:\n - \"native:host\""
notify: Restart act_runner
- name: Register runner with Gitea
ansible.builtin.command:
cmd: >
act_runner register
--no-interactive
--instance "{{ gitea_runner_url }}"
--token "{{ gitea_runner_registration_token }}"
--name "{{ gitea_runner_name }}"
--labels "{{ gitea_runner_labels }}"
--config /etc/act_runner/config.yml
chdir: /var/lib/act_runner
creates: /var/lib/act_runner/.runner
become_user: act_runner
- name: Install act_runner systemd service
ansible.builtin.copy:
dest: /etc/systemd/system/act_runner.service
content: |
[Unit]
Description=Gitea Actions Runner
After=network.target
[Service]
Type=simple
User=act_runner
WorkingDirectory=/var/lib/act_runner
ExecStart=/usr/local/bin/act_runner daemon --config /etc/act_runner/config.yml
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
owner: root
group: root
mode: "0644"
notify: Restart act_runner
- name: Enable and start act_runner
ansible.builtin.systemd:
name: act_runner
enabled: true
state: started
daemon_reload: true