2024-01-13 21:47:50 -08:00
|
|
|
---
|
|
|
|
# Adapted from https://forgejo.org/docs/latest/admin/installation-binary/
|
|
|
|
- name: Install Forgejo
|
|
|
|
hosts: webserver
|
|
|
|
become: yes
|
|
|
|
become_user: root
|
|
|
|
tasks:
|
|
|
|
- name: Download Forgejo binary to /usr/local/bin (and verify its checksum)
|
|
|
|
get_url:
|
|
|
|
url: https://codeberg.org/forgejo/forgejo/releases/download/v1.21.3-0/forgejo-1.21.3-0-linux-amd64
|
|
|
|
dest: /usr/local/bin/forgejo
|
|
|
|
checksum: "sha256:8c8f34e889f968b4f9357701ceee7daab5b47ea605793325da8e3e740457b45a"
|
|
|
|
mode: "755"
|
|
|
|
|
|
|
|
- name: Update apt cache
|
|
|
|
apt:
|
|
|
|
update_cache: true
|
|
|
|
|
|
|
|
- name: Install git and git-lfs
|
|
|
|
apt:
|
|
|
|
name:
|
|
|
|
- git
|
|
|
|
- git-lfs
|
|
|
|
|
|
|
|
- name: Create git user
|
|
|
|
user:
|
|
|
|
name: git
|
|
|
|
password: "!" # disables password login
|
|
|
|
home: /home/git
|
|
|
|
shell: /bin/bash
|
|
|
|
comment: Git Version Control
|
|
|
|
|
|
|
|
- name: Create Forgejo's data directory
|
|
|
|
file:
|
|
|
|
path: /var/lib/forgejo
|
|
|
|
state: directory
|
|
|
|
mode: "750"
|
|
|
|
owner: git
|
|
|
|
group: git
|
|
|
|
|
|
|
|
- name: Create Forgejo's config directory
|
|
|
|
file:
|
|
|
|
path: /etc/forgejo
|
|
|
|
state: directory
|
2024-01-13 22:08:44 -08:00
|
|
|
mode: "750"
|
2024-01-13 21:47:50 -08:00
|
|
|
owner: root
|
|
|
|
group: git
|
|
|
|
|
2024-01-13 22:08:44 -08:00
|
|
|
- name: Copy app.ini to Forgejo's config directory
|
|
|
|
copy:
|
|
|
|
src: files/app.ini
|
|
|
|
dest: /etc/forgejo/app.ini
|
|
|
|
mode: "640"
|
|
|
|
notify:
|
|
|
|
- Restart Forgejo
|
|
|
|
|
2024-01-14 23:54:01 -08:00
|
|
|
- name: Copy secrets directory to Forgejo's config directory
|
|
|
|
copy:
|
|
|
|
src: files/secrets
|
|
|
|
dest: /etc/forgejo
|
|
|
|
directory_mode: "750"
|
|
|
|
mode: "640"
|
|
|
|
owner: root
|
|
|
|
group: git
|
|
|
|
notify:
|
|
|
|
- Restart Forgejo
|
|
|
|
|
2024-01-13 21:47:50 -08:00
|
|
|
- name: Install systemd service for Forgejo
|
|
|
|
copy:
|
|
|
|
src: files/forgejo.service
|
|
|
|
dest: /etc/systemd/system/forgejo.service
|
|
|
|
notify:
|
2024-01-14 06:08:00 -08:00
|
|
|
- Reload service files
|
2024-01-13 22:08:44 -08:00
|
|
|
- Restart Forgejo
|
2024-01-13 21:47:50 -08:00
|
|
|
|
2024-01-14 06:08:00 -08:00
|
|
|
- name: Enable Forgejo service
|
2024-01-13 21:47:50 -08:00
|
|
|
systemd_service:
|
|
|
|
name: forgejo
|
2024-01-14 06:08:00 -08:00
|
|
|
enabled: true
|
2024-01-13 21:47:50 -08:00
|
|
|
state: started
|
|
|
|
|
|
|
|
handlers:
|
2024-01-14 06:08:00 -08:00
|
|
|
- name: Reload service files
|
|
|
|
systemd_service:
|
|
|
|
daemon_reload: true
|
|
|
|
|
2024-01-13 22:08:44 -08:00
|
|
|
- name: Restart Forgejo
|
2024-01-13 21:47:50 -08:00
|
|
|
systemd_service:
|
|
|
|
name: forgejo
|
|
|
|
state: restarted
|