73 lines
2 KiB
YAML
73 lines
2 KiB
YAML
---
|
|
# 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
|
|
mode: "770"
|
|
owner: root
|
|
group: git
|
|
|
|
- name: Install systemd service for Forgejo
|
|
copy:
|
|
src: files/forgejo.service
|
|
dest: /etc/systemd/system/forgejo.service
|
|
notify:
|
|
- Reload Forgejo's service file and restart Forgejo
|
|
|
|
- name: Start Forgejo service
|
|
systemd_service:
|
|
name: forgejo
|
|
state: started
|
|
|
|
- name: Print hint to go configure
|
|
debug:
|
|
msg: >
|
|
Forgejo is now running on port 3000! Run `ssh -L 3000:localhost:3000
|
|
code.openneo.net` to be able to open `localhost:3000` in your local
|
|
browser and have it redirect to Forgejo's setup page!
|
|
|
|
handlers:
|
|
- name: Reload Forgejo's service file and restart Forgejo
|
|
systemd_service:
|
|
name: forgejo
|
|
state: restarted
|
|
daemon_reload: true
|