Add Template to deploy forgejo.

This template allows deploying a forgejo en either Scaleway or Hetzner
(untested) without much knowledge about them.
It DOES require knowledge about Terragrunt and ansible. A wizard of
sorts is provided but it will not guarantee success without some
knowledge about the underlying technology.
This commit is contained in:
Horacio Duran 2026-01-09 16:07:44 +01:00
parent a9f546f92a
commit 822e42dbb8
48 changed files with 6846 additions and 2 deletions

View file

@ -0,0 +1,60 @@
---
# External volume setup tasks
- name: Check if volume device exists
ansible.builtin.stat:
path: "{{ forgejo_volume_device }}"
register: volume_device
- name: Fail if volume device not found
ansible.builtin.fail:
msg: "Volume device {{ forgejo_volume_device }} not found"
when: not volume_device.stat.exists
- name: Check if volume is already formatted
ansible.builtin.command:
cmd: "blkid {{ forgejo_volume_device }}"
register: volume_formatted
changed_when: false
failed_when: false
- name: Format volume with ext4
ansible.builtin.filesystem:
fstype: ext4
dev: "{{ forgejo_volume_device }}"
become: yes
when: volume_formatted.rc != 0
- name: Create mount point
ansible.builtin.file:
path: "{{ forgejo_volume_mount }}"
state: directory
mode: '0755'
become: yes
- name: Mount volume
ansible.posix.mount:
path: "{{ forgejo_volume_mount }}"
src: "{{ forgejo_volume_device }}"
fstype: ext4
opts: defaults,nofail
state: mounted
become: yes
- name: Update data path to use volume
ansible.builtin.set_fact:
forgejo_data_path: "{{ forgejo_volume_mount }}/data"
- name: Create data directories on volume
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ forgejo_user }}"
group: "{{ forgejo_group }}"
mode: '0755'
become: yes
loop:
- "{{ forgejo_data_path }}"
- "{{ forgejo_data_path }}/git"
- "{{ forgejo_data_path }}/attachments"
- "{{ forgejo_data_path }}/lfs"