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.
60 lines
1.5 KiB
YAML
60 lines
1.5 KiB
YAML
---
|
|
# 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"
|