add possibility to choose between forgejo or gitea (#22)

Co-authored-by: meaz <meaz@disroot.org>
Co-authored-by: muppeth <muppeth@disroot.org>
Reviewed-on: Disroot-Ansible/gitea#22
Reviewed-by: muppeth <muppeth@no-reply@disroot.org>
Co-authored-by: meaz <meaz@no-reply@disroot.org>
Co-committed-by: meaz <meaz@no-reply@disroot.org>
This commit is contained in:
meaz 2023-01-24 08:45:17 +00:00 committed by muppeth
parent 9862d76824
commit 2558786ef3
3 changed files with 31 additions and 6 deletions

View File

@ -1,6 +1,6 @@
# Gitea - Ansible Role
This role covers deployment, configuration and software updates of Gitea. This role is released under MIT Licence and we give no warranty for this piece of software. Currently supported OS - Debian.
This role covers deployment, configuration and software updates of Gitea/Forgejo. This role is released under MIT Licence and we give no warranty for this piece of software. Currently supported OS - Debian.
You can deploy test instance using `Vagrantfile` attached to the role.
`vagrant up`
@ -9,6 +9,18 @@ You can deploy test instance using `Vagrantfile` attached to the role.
Then you can then access gitea from your computer on `http://192.168.33.14:3000`
# Gitea or Forgejo
This role allows for deployment of gitea and forgejo. By default the role deploys forgejo and this is the flavor that is supported and maintained. Installing Gitea using the role is possible however starting from version 1.18.2 is no longer maintained by Disroot team.
To switch to gitea, update following variables in your Playbook/host_vars:
```
gitea_flavour: 'gitea'
gitea_version: '1.18.2'
gitea_arch: 'linux-amd64'
gitea_download_url: 'https://github.com/go-gitea/gitea/releases/download/v{{ gitea_version }}/gitea-{{ gitea_version }}-{{ gitea_arch }}'
```
## Playbook
The playbook includes postgresql role and deploys entire stack needed to run Gitea. Additional roles are also available in the Ansible roles repos in git.

View File

@ -5,8 +5,11 @@ gitea_lib_dir: "/var/lib/gitea"
gitea_user: 'git'
gitea_group: 'git'
gitea_confdir: '/etc/gitea/app.ini'
gitea_version: '1.18.0'
gitea_flavor: 'forgejo'
gitea_version: '1.18.2-1'
gitea_arch: 'linux-amd64'
#gitea_download_url: 'https://github.com/go-gitea/gitea/releases/download/v{{ gitea_version }}/gitea-{{ gitea_version }}-{{ gitea_arch }}'
#[CONFIG]
@ -20,6 +23,7 @@ gitea_oauth2_config:
- 'JWT_SECRET = ' #41 random chars
gitea_ui_config:
- 'THEMES = auto,arc-green,gitea'
- 'DEFAULT_THEME = arc-green'
gitea_security_config:

View File

@ -5,10 +5,20 @@
name: "{{ gitea_apt_list }}"
update_cache: yes
- name: '[INSTALL] - Get forgejo download url'
shell:
cmd: wget -O - https://codeberg.org/forgejo/forgejo/releases | grep -B 1 forgejo-{{ gitea_version }}-{{ gitea_arch }}\< | sed -n 's/.*href="\(.*\)".*/\1/p'
register: forgejo_url
when: gitea_flavor == 'forgejo'
- name: "[INSTALL] - Set forgejo download url"
set_fact:
gitea_download_url: '{{ forgejo_url.stdout }}'
when: gitea_flavor == 'forgejo'
- name: '[INSTALL] - Download gitea binary'
get_url:
url: 'https://github.com/go-gitea/gitea/releases/download/v{{ gitea_version }}/gitea-{{ gitea_version }}-linux-amd64'
url: '{{ gitea_download_url }}'
dest: '{{ gitea_bindir }}/gitea'
mode: '0750'
owner: '{{ gitea_user }}'
@ -16,13 +26,12 @@
force: 'yes'
notify: 'Restart gitea'
- name: '[INSTALL] - Set rights to read-only'
- name: '[INSTALL] - Set /etc/gitea rights to read-only'
file:
path: '/etc/gitea'
mode: '0750'
- name: '[INSTALL] - Set rights to read-only'
- name: '[INSTALL] - Set app.ini rights to read-only'
file:
path: '/etc/gitea/app.ini'
mode: '0640'