Compare commits

..

4 commits
8.0.1 ... main

Author SHA1 Message Date
f389a83062 from staging to main, update to 9.0.3 (#63)
Co-authored-by: muppeth <muppeth@disroot.org>
Co-authored-by: muppeth <muppeth@no-reply@disroot.org>
Reviewed-on: #63
Reviewed-by: muppeth <muppeth@no-reply@disroot.org>
Co-authored-by: meaz <meaz@disroot.org>
Co-committed-by: meaz <meaz@disroot.org>
2025-01-07 21:02:30 +01:00
bd4c5af5bb 9.0.2 (#61)
- Updated to version 9.0.2
-  Improved and simplified download url
-  Applied style guide

Co-authored-by: meaz <meaz@disroot.org>
Reviewed-on: #61
Reviewed-by: meaz <meaz@no-reply@disroot.org>
Co-authored-by: muppeth <muppeth@disroot.org>
Co-committed-by: muppeth <muppeth@disroot.org>
2024-12-03 21:14:24 +01:00
4e2d8007bb Version 8.0.3 (#58)
Co-authored-by: meaz <meaz@disroot.org>
Reviewed-on: #58
Reviewed-by: meaz <meaz@no-reply@disroot.org>
Co-authored-by: muppeth <muppeth@disroot.org>
Co-committed-by: muppeth <muppeth@disroot.org>
2024-10-08 20:56:43 +02:00
041aa75a0d 8.0.2 (#57)
Co-authored-by: meaz <meaz@disroot.org>
Reviewed-on: #57
Reviewed-by: meaz <meaz@no-reply@disroot.org>
Co-authored-by: muppeth <muppeth@disroot.org>
Co-committed-by: muppeth <muppeth@disroot.org>
2024-09-03 21:01:13 +02:00
11 changed files with 229 additions and 198 deletions

6
.ansible-lint Normal file
View file

@ -0,0 +1,6 @@
skip_list:
- fqcn-builtins
- fqcn[action]
- fqcn[action-core]
- fqcn[canonical]
- name[casing]

View file

@ -1,4 +1,5 @@
--- ---
- name: 'Create backup directories' - name: 'Create backup directories'
hosts: forgejo hosts: forgejo
tasks: tasks:
@ -43,10 +44,10 @@
shell: shell:
cmd: 'sudo -u {{ forgejo_user }} {{ forgejo_bindir }}/forgejo dump -c {{ forgejo_confdir }}' cmd: 'sudo -u {{ forgejo_user }} {{ forgejo_bindir }}/forgejo dump -c {{ forgejo_confdir }}'
chdir: '{{ forgejo_dump_path}}/code' chdir: '{{ forgejo_dump_path}}/code'
vars_files: vars_files:
- ../defaults/main.yml - ../defaults/main.yml
- name: 'Run Forgejo role' - name: 'Run Forgejo role'
hosts: forgejo hosts: forgejo
roles: roles:
- postgresql - postgresql
@ -56,4 +57,4 @@
- ../defaults/main.yml - ../defaults/main.yml
vars: vars:
- ansible_python_interpreter: "/usr/bin/python3" - ansible_python_interpreter: '/usr/bin/python3'

View file

@ -7,20 +7,20 @@ forgejo_group: 'git'
forgejo_confdir: '/etc/forgejo/app.ini' forgejo_confdir: '/etc/forgejo/app.ini'
forgejo_dump_path: '/srv/forgejo-dump' forgejo_dump_path: '/srv/forgejo-dump'
forgejo_flavor: 'forgejo' forgejo_flavor: 'forgejo'
forgejo_version: '8.0.1' forgejo_version: '9.0.3'
#forgejo_version: '1.21.7-0'
forgejo_arch: 'linux-amd64' forgejo_arch: 'linux-amd64'
#forgejo_download_url: 'https://github.com/go-gitea/gitea/releases/download/v{{ forgejo_version }}/gitea-{{ forgejo_version }}-{{ forgejo_arch }}' forgejo_download_url: 'https://codeberg.org/forgejo/forgejo/releases/download/v{{ forgejo_version }}/forgejo-{{ forgejo_version }}-{{ forgejo_arch }}'
# Uncomment below if you want to add custom themes or images # Uncomment below if you want to add custom themes or images
#forgejo_extra_files_path: '../img' # the folder name where you have the images you want to deploy # forgejo_extra_files_path: '../img' # the folder name where you have the images you want to deploy
forgejo_theme_dir: '{{ forgejo_lib_dir }}/custom' forgejo_theme_dir: '{{ forgejo_lib_dir }}/custom'
#forgejo_custom_themes: # forgejo_custom_themes:
# - name: '' #add name of the theme # - name: '' # add name of the theme
# repo: '' #add git repository of the theme # repo: '' # add git repository of the theme
# enable: 'true' #set it to false to remove it # version: '' # add git branch
# enable: 'true' # set it to false to remove it
#[CONFIG] # [CONFIG]
# App.ini file variables # App.ini file variables
forgejo_base_config: forgejo_base_config:
- 'APP_NAME = Forgejo: Beyond coding. We forge.' - 'APP_NAME = Forgejo: Beyond coding. We forge.'
@ -29,16 +29,22 @@ forgejo_base_config:
- 'WORK_PATH = {{ forgejo_lib_dir }}' - 'WORK_PATH = {{ forgejo_lib_dir }}'
forgejo_oauth2_config: forgejo_oauth2_config:
- 'JWT_SECRET = ' #41 random chars - 'JWT_SECRET = ' # 41 random chars
forgejo_oauth2_client_config:
- 'ENABLE_AUTO_REGISTRATION = false'
- 'REGISTER_EMAIL_CONFIRM = false'
- 'ACCOUNT_LINKING = login'
- 'UPDATE_AVATAR = false'
forgejo_ui_config: forgejo_ui_config:
- 'THEMES = gitea-auto,gitea-light,gitea-dark,forgejo-auto,forgejo-light,forgejo-dark' # add only the default ones, not themes ones - 'THEMES = gitea-auto,gitea-light,gitea-dark,forgejo-auto,forgejo-light,forgejo-dark' # add only the default ones, not themes ones
- 'DEFAULT_THEME = gitea-dark' - 'DEFAULT_THEME = gitea-dark'
forgejo_security_config: forgejo_security_config:
- 'INTERNAL_TOKEN = ' #106 random chars - 'INTERNAL_TOKEN = ' # 106 random chars
- 'INSTALL_LOCK = true' - 'INSTALL_LOCK = true'
- 'SECRET_KEY = ' #64 random chars - 'SECRET_KEY = ' # 64 random chars
forgejo_database_config: forgejo_database_config:
- 'DB_TYPE = postgres' - 'DB_TYPE = postgres'
@ -59,12 +65,12 @@ forgejo_server_config:
- 'DISABLE_SSH = false' - 'DISABLE_SSH = false'
- 'SSH_PORT = 22' - 'SSH_PORT = 22'
- 'LFS_START_SERVER = true' - 'LFS_START_SERVER = true'
- 'LFS_JWT_SECRET = ' #40 random chars - 'LFS_JWT_SECRET = ' # 40 random chars
- 'OFFLINE_MODE = false' - 'OFFLINE_MODE = false'
- 'APP_DATA_PATH = {{ forgejo_lib_dir }}/data/' - 'APP_DATA_PATH = {{ forgejo_lib_dir }}/data/'
forgejo_lfs_config: forgejo_lfs_config:
- 'PATH = /home/git/data/lfs' - 'PATH = /home/git/data/lfs'
forgejo_mailer_config: forgejo_mailer_config:
- 'ENABLED = true' - 'ENABLED = true'
@ -72,7 +78,7 @@ forgejo_mailer_config:
- 'SMTP_PORT = 587' - 'SMTP_PORT = 587'
- 'FROM = noreply@example.org' - 'FROM = noreply@example.org'
- 'USER = noreply@example.org' - 'USER = noreply@example.org'
- 'PASSWD = CHANGEME' #PASSWD - 'PASSWD = CHANGEME' # PASSWORD
- 'PROTOCOL = smtp+starttls' - 'PROTOCOL = smtp+starttls'
forgejo_service_config: forgejo_service_config:
@ -142,34 +148,34 @@ forgejo_email_incoming:
# forgejo_cap_net_bind_service: 'CAP_NET_BIND_SERVICE' # Uncomment if you want to bind Forgejo to a port below 1024, or use socket activation to pass Forgejo its ports as above # forgejo_cap_net_bind_service: 'CAP_NET_BIND_SERVICE' # Uncomment if you want to bind Forgejo to a port below 1024, or use socket activation to pass Forgejo its ports as above
# forgejo_privateusers: 'false' # Uncomment, when using forgejo_cap_net_bind_service option, to allow capabilities to be applied on Forgejo process. If set to true sandboxes Forgejo service and prevent any processes from running with privileges in the host user namespace # forgejo_privateusers: 'false' # Uncomment, when using forgejo_cap_net_bind_service option, to allow capabilities to be applied on Forgejo process. If set to true sandboxes Forgejo service and prevent any processes from running with privileges in the host user namespace
#apt # apt
forgejo_apt_list: forgejo_apt_list:
- git - git
# POSTGRES # POSTGRES
postgresql_version: 13 postgresql_version: 15
postgresql_listen_addresses: postgresql_listen_addresses:
- "127.0.0.1" - "127.0.0.1"
postgresql_pg_hba_default: postgresql_pg_hba_default:
- { type: local, database: all, user: '{{ postgresql_admin_user }}', address: '', method: '{{ postgresql_default_auth_method }}', comment: '' } - { type: local, database: all, user: '{{ postgresql_admin_user }}', address: '', method: '{{ postgresql_default_auth_method }}', comment: ''}
- { type: local, database: all, user: all, address: '', method: '{{ postgresql_default_auth_method }}', comment: '"local" is for Unix domain socket connections only' } - { type: local, database: all, user: all, address: '', method: '{{ postgresql_default_auth_method }}', comment: '"local" is for Unix domain socket connections only'}
- { type: host, database: all, user: all, address: '127.0.0.1/32', method: '{{ postgresql_default_auth_method_hosts }}', comment: 'IPv4 local connections:' } - { type: host, database: all, user: all, address: '127.0.0.1/32', method: '{{ postgresql_default_auth_method_hosts }}', comment: 'IPv4 local connections:'}
postgresql_databases: postgresql_databases:
- name: forgejo - name: 'forgejo'
owner: admin # optional; specify the owner of the database owner: 'admin' # optional; specify the owner of the database
hstore: no # flag to install the hstore extension on this database (yes/no) hstore: 'no' # flag to install the hstore extension on this database (yes/no)
uuid_ossp: no # flag to install the uuid-ossp extension on this database (yes/no) uuid_ossp: 'no' # flag to install the uuid-ossp extension on this database (yes/no)
citext: no # flag to install the citext extension on this database (yes/no) citext: 'no' # flag to install the citext extension on this database (yes/no)
postgresql_users: postgresql_users:
- name: admin - name: 'admin'
pass: changeme pass: 'changeme'
encrypted: yes # denotes if the password is already encrypted. encrypted: 'yes' # denotes if the password is already encrypted.
postgresql_user_privileges: postgresql_user_privileges:
- name: admin # user name - name: 'admin' # user name
db: forgejo # database db: 'forgejo' # database
priv: "ALL" # privilege string format: example: INSERT,UPDATE/table:SELECT/anothertable:ALL priv: 'ALL' # privilege string format: example: INSERT,UPDATE/table:SELECT/anothertable:ALL
role_attr_flags: "" # role attribute flags role_attr_flags: '' # role attribute flags

View file

@ -2,10 +2,10 @@
- name: 'Restart forgejo' - name: 'Restart forgejo'
systemd: systemd:
name: forgejo name: 'forgejo'
state: restarted state: 'restarted'
- name: 'Stop forgejo' - name: 'Stop forgejo'
systemd: systemd:
name: forgejo name: 'forgejo'
state: stopped state: 'stopped'

View file

@ -3,26 +3,26 @@
- name: '[DIR] - Create bin dir' - name: '[DIR] - Create bin dir'
file: file:
path: '{{ forgejo_bindir }}' path: '{{ forgejo_bindir }}'
state: directory state: 'directory'
owner: "{{ forgejo_user }}" owner: '{{ forgejo_user }}'
group: "{{ forgejo_group }}" group: '{{ forgejo_group }}'
mode: '0750' mode: '0750'
- name: '[DIR] - Create lib dir' - name: '[DIR] - Create lib dir'
file: file:
path: '{{ forgejo_lib_dir }}' path: '{{ forgejo_lib_dir }}'
state: directory state: 'directory'
mode: '0750' mode: '0750'
owner: "{{ forgejo_user }}" owner: '{{ forgejo_user }}'
group: "{{ forgejo_group }}" group: '{{ forgejo_group }}'
- name: '[DIR] - Create lib dirs' - name: '[DIR] - Create lib dirs'
file: file:
path: "{{ forgejo_lib_dir }}/{{ item }}" path: '{{ forgejo_lib_dir }}/{{ item }}'
state: directory state: 'directory'
mode: '0750' mode: '0750'
owner: "{{ forgejo_user }}" owner: '{{ forgejo_user }}'
group: "{{ forgejo_group }}" group: '{{ forgejo_group }}'
with_items: with_items:
- 'custom' - 'custom'
- 'data' - 'data'
@ -30,53 +30,62 @@
- name: '[DIR] - Create etc dir' - name: '[DIR] - Create etc dir'
file: file:
path: /etc/forgejo path: '/etc/forgejo'
state: directory state: 'directory'
mode: '0770' mode: '0770'
owner: "{{ forgejo_user }}" owner: '{{ forgejo_user }}'
group: "{{ forgejo_group }}" group: '{{ forgejo_group }}'
- name: '[CONF] - Deploy forgejo config' - name: '[CONF] - Deploy forgejo config'
template: template:
src: etc/forgejo/app.ini.j2 src: 'etc/forgejo/app.ini.j2'
dest: "{{ forgejo_confdir }}" dest: '{{ forgejo_confdir }}'
owner: "{{ forgejo_user }}" owner: '{{ forgejo_user }}'
group: "{{ forgejo_group }}" group: '{{ forgejo_group }}'
notify: Restart forgejo mode: '0744'
tags: config notify:
- 'Restart forgejo'
tags:
- 'config'
- name: "[CONF] - Create assets dir" - name: '[CONF] - Create assets dir'
file: file:
path: "{{ forgejo_theme_dir }}/public/assets/" path: '{{ forgejo_theme_dir }}/public/assets/'
state: 'directory' state: 'directory'
owner: '{{ forgejo_user }}' owner: '{{ forgejo_user }}'
group: '{{ forgejo_group }}' group: '{{ forgejo_group }}'
mode: '0744'
when: forgejo_extra_files_path is defined when: forgejo_extra_files_path is defined
tags: config tags:
- 'config'
- name: "[CONF] - Create img folder" - name: '[CONF] - Create img folder'
file: file:
path: "{{ forgejo_theme_dir }}/public/assets/img/" path: '{{ forgejo_theme_dir }}/public/assets/img/'
state: 'directory' state: 'directory'
owner: '{{ forgejo_user }}' owner: '{{ forgejo_user }}'
group: '{{ forgejo_group }}' group: '{{ forgejo_group }}'
mode: '0744'
when: forgejo_extra_files_path is defined when: forgejo_extra_files_path is defined
tags: config tags:
- 'config'
- name: "[CONF] - Deploy img folder" - name: '[CONF] - Deploy img folder'
copy: copy:
src: '{{ forgejo_extra_files_path }}/' src: '{{ forgejo_extra_files_path }}/'
dest: "{{ forgejo_theme_dir }}/public/assets/img/" dest: '{{ forgejo_theme_dir }}/public/assets/img/'
owner: "{{ forgejo_user }}" owner: '{{ forgejo_user }}'
group: "{{ forgejo_group }}" group: '{{ forgejo_group }}'
mode: 0755 mode: '0744'
when: forgejo_extra_files_path is defined when: forgejo_extra_files_path is defined
tags: config tags:
- 'config'
- name: '[CONF] - Install dependencies for renderers' - name: '[CONF] - Install dependencies for renderers'
apt: apt:
name: "{{ item.apt }}" name: '{{ item.apt }}'
update_cache: yes update_cache: true
loop: "{{ forgejo_markup_config }}" loop: '{{ forgejo_markup_config }}'
when: item.enable == 'true' and item.apt != "" when: item.enable | bool and item.apt != ''
tags: config tags:
- 'config'

View file

@ -3,77 +3,89 @@
- name: '[THEME] - Create css dir' - name: '[THEME] - Create css dir'
file: file:
path: '{{ forgejo_theme_dir }}/public/assets/css' path: '{{ forgejo_theme_dir }}/public/assets/css'
state: directory state: 'directory'
owner: "{{ forgejo_user }}" owner: '{{ forgejo_user }}'
group: "{{ forgejo_group }}" group: '{{ forgejo_group }}'
tags: theme mode: '0744'
tags:
- 'theme'
# First, remove the css files from public folder, then theme repos # First, remove the css files from public folder, then theme repos
- name: "[THEME] - Remove css files from the css folder" - name: '[THEME] - Remove css files from the css folder'
shell: command:
cmd: find "{{ forgejo_theme_dir }}/{{ item.name }}" -type f -name "*.css" -printf "%f\n" | xargs -I{} rm public/assets/css/{} cmd: bash -c 'find "{{ forgejo_theme_dir }}/{{ item.name }}" -type f -name "*.css" -printf "%f\n" | xargs -I{} rm public/assets/css/{}'
chdir: "{{ forgejo_theme_dir }}" # find "{{ forgejo_theme_dir }}/{{ item.name }}" -type f -name "*.css" -printf "%f\n" | xargs -I{} rm public/assets/css/{}
loop: "{{ forgejo_custom_themes }}" chdir: '{{ forgejo_theme_dir }}'
when: item.enable == 'false' loop: '{{ forgejo_custom_themes }}'
tags: theme when: not item.enable | bool
tags:
- 'theme'
- name: "[THEME] - Remove theme repo" - name: '[THEME] - Remove theme repo'
file: file:
path: "{{ forgejo_theme_dir }}/{{ item.name }}" path: '{{ forgejo_theme_dir }}/{{ item.name }}'
state: absent state: 'absent'
owner: "{{ forgejo_user }}" owner: '{{ forgejo_user }}'
group: "{{ forgejo_group }}" group: '{{ forgejo_group }}'
loop: "{{ forgejo_custom_themes }}" loop: '{{ forgejo_custom_themes }}'
when: item.enable == 'false' when: not item.enable | bool
tags: theme tags:
- 'theme'
# Second, get theme repos and deploy css files in public folder # Second, get theme repos and deploy css files in public folder
- name: "[THEME] - Get repo" - name: '[THEME] - Get repo'
git: git:
repo: "{{ item.repo }}" repo: '{{ item.repo }}'
dest: "{{ forgejo_theme_dir }}/{{ item.name }}" dest: '{{ forgejo_theme_dir }}/{{ item.name }}'
force: yes version: '{{ item.version }}'
loop: "{{ forgejo_custom_themes }}" force: true
when: item.enable == 'true' loop: '{{ forgejo_custom_themes }}'
when: item.enable | bool
become: true become: true
become_user: "{{ forgejo_user }}" become_user: '{{ forgejo_user }}'
tags: theme tags:
- 'theme'
- name: "[THEME] - Find css files from different repos" - name: '[THEME] - Find css files from different repos'
find: find:
paths: "{{ forgejo_theme_dir }}" paths: '{{ forgejo_theme_dir }}'
patterns: ".*(?<!\\.min)\\.css$" patterns: ".*(?<!\\.min)\\.css$"
recurse: yes recurse: true
use_regex: yes use_regex: true
register: css_files register: 'css_files'
tags: theme tags:
- 'theme'
- name: "[THEME] - Copy css files to the public folder" - name: '[THEME] - Copy css files to the public folder'
copy: copy:
src: "{{ item.path }}" src: '{{ item.path }}'
dest: "{{ forgejo_theme_dir }}/public/assets/css/" dest: '{{ forgejo_theme_dir }}/public/assets/css/'
remote_src: yes remote_src: true
force: yes force: true
mode: '0644' mode: '0644'
with_items: "{{ css_files.files }}" with_items: '{{ css_files.files }}'
when: "'/public/' not in item.path" when: "'/public/' not in item.path"
become: true become: true
become_user: "{{ forgejo_user }}" become_user: '{{ forgejo_user }}'
tags: theme tags:
- 'theme'
# Lastly, update app.ini by adding the theme's name list. # Lastly, update app.ini by adding the theme's name list.
- name: "[THEME] - Get and prepare a list for app.ini of css files in public folder, register it" - name: '[THEME] - Get and prepare a list for app.ini of css files in public folder, register it'
shell: command:
cmd: ls "{{ forgejo_theme_dir }}/public/assets/css" | awk '{ if ($0 ~ /^theme-/) { gsub(/^theme-/, "", $0) }; gsub(/.css$/, "", $0); print }' | paste -s -d, cmd: bash -c "ls '{{ forgejo_theme_dir }}/public/assets/css' | awk '{ if ($0 ~ /^theme-/) { gsub(/^theme-/, \"\", $0) }; gsub(/.css$/, \"\", $0); print }' | paste -s -d,"
chdir: "{{ forgejo_theme_dir }}" chdir: "{{ forgejo_theme_dir }}"
register: theme_name register: 'theme_name'
tags: theme tags:
- 'theme'
- name: "[THEME] - Add list of themes in app.ini" - name: '[THEME] - Add list of themes in app.ini'
lineinfile: lineinfile:
path: "{{ forgejo_confdir }}" path: '{{ forgejo_confdir }}'
regexp: '^THEMES' regexp: '^THEMES'
line: "{{ forgejo_ui_config[0] }},{{ theme_name.stdout }}" line: '{{ forgejo_ui_config[0] }},{{ theme_name.stdout }}'
notify: Restart forgejo notify:
tags: theme - 'Restart forgejo'
tags:
- 'theme'

View file

@ -2,24 +2,13 @@
- name: '[INSTALL] - Install dependencies' - name: '[INSTALL] - Install dependencies'
apt: apt:
name: "{{ forgejo_apt_list }}" name: '{{ forgejo_apt_list }}'
update_cache: yes update_cache: true
- name: '[INSTALL] - Get forgejo download url'
shell:
cmd: wget -O - https://codeberg.org/forgejo/forgejo/releases | grep -B 1 forgejo-{{ forgejo_version }}-{{ forgejo_arch }}\< | sed -n 's/.*href="\(.*\)".*/\1/p'
register: forgejo_url
when: forgejo_flavor == 'forgejo'
- name: "[INSTALL] - Set forgejo download url"
set_fact:
forgejo_download_url: '{{ forgejo_url.stdout }}'
when: forgejo_flavor == 'forgejo'
- name: '[INSTALL] - Check if forgejo is already installed' - name: '[INSTALL] - Check if forgejo is already installed'
shell: shell:
cmd: '{{ forgejo_bindir }}/forgejo --version -c {{ forgejo_confdir }}' cmd: '{{ forgejo_bindir }}/forgejo --version -c {{ forgejo_confdir }}'
register: forgejo_is_installed register: 'forgejo_is_installed'
ignore_errors: true # needed when forgejo is not yet installed ignore_errors: true # needed when forgejo is not yet installed
# The following task is needed for the doctor check task, as `gitea-repositories` needs to exist, # The following task is needed for the doctor check task, as `gitea-repositories` needs to exist,
@ -28,23 +17,23 @@
# It also allows to make sure forgejo was installed and used. # It also allows to make sure forgejo was installed and used.
- name: '[INSTALL] - Check gitea-repositories exists' - name: '[INSTALL] - Check gitea-repositories exists'
stat: stat:
path: "{{ forgejo_lib_dir }}/gitea-repositories" path: '{{ forgejo_lib_dir }}/gitea-repositories'
register: gitea_repositories register: 'gitea_repositories'
- name: '[UPGRADE] - Check forgejo health with doctor before updating' - name: '[UPGRADE] - Check forgejo health with doctor before updating'
shell: shell:
cmd: '{{ forgejo_bindir }}/forgejo doctor check --all -c {{ forgejo_confdir }}' cmd: '{{ forgejo_bindir }}/forgejo doctor check --all -c {{ forgejo_confdir }}'
become: 'yes' become: true
become_user: '{{ forgejo_user }}' become_user: '{{ forgejo_user }}'
register: forgejo_health register: 'forgejo_health'
when: when:
- forgejo_is_installed.rc == 0 - forgejo_is_installed.rc == 0
- gitea_repositories.stat.exists - gitea_repositories.stat.exists
- name: '[UPGRADE] - Restart forgejo' - name: '[UPGRADE] - Restart forgejo'
systemd: systemd:
name: forgejo name: 'forgejo'
state: restarted state: 'restarted'
when: when:
- forgejo_is_installed.rc == 0 - forgejo_is_installed.rc == 0
- forgejo_health is defined and forgejo_health.rc is defined and forgejo_health.rc == 0 - forgejo_health is defined and forgejo_health.rc is defined and forgejo_health.rc == 0
@ -58,17 +47,17 @@
- name: '[UPGRADE] - Flush all queues' - name: '[UPGRADE] - Flush all queues'
shell: shell:
cmd: '{{ forgejo_bindir }}/forgejo manager flush-queues -c {{ forgejo_confdir }}' cmd: '{{ forgejo_bindir }}/forgejo manager flush-queues -c {{ forgejo_confdir }}'
become: 'yes' become: true
become_user: '{{ forgejo_user }}' become_user: '{{ forgejo_user }}'
when: when:
- forgejo_is_installed.rc == 0 - forgejo_is_installed.rc == 0
- forgejo_health is defined and forgejo_health.rc is defined and forgejo_health.rc == 0 - forgejo_health is defined and forgejo_health.rc is defined and forgejo_health.rc == 0
- name: '[UPGRADE] - Stop forgejo' - name: '[UPGRADE] - Stop forgejo'
systemd: systemd:
name: forgejo name: 'forgejo'
state: stopped state: 'stopped'
when: when:
- forgejo_is_installed.rc == 0 - forgejo_is_installed.rc == 0
- forgejo_health is defined and forgejo_health.rc is defined and forgejo_health.rc == 0 - forgejo_health is defined and forgejo_health.rc is defined and forgejo_health.rc == 0
@ -80,8 +69,9 @@
mode: '0750' mode: '0750'
owner: '{{ forgejo_user }}' owner: '{{ forgejo_user }}'
group: '{{ forgejo_group }}' group: '{{ forgejo_group }}'
force: 'yes' force: true
notify: 'Restart forgejo' notify:
- 'Restart forgejo'
- name: '[INSTALL] - Set /etc/forgejo rights to read-only' - name: '[INSTALL] - Set /etc/forgejo rights to read-only'
file: file:
@ -94,20 +84,20 @@
mode: '0640' mode: '0640'
- name: '[UPGRADE] - Check forgejo health after upgrading' - name: '[UPGRADE] - Check forgejo health after upgrading'
shell: command:
cmd: '{{ forgejo_bindir }}/forgejo doctor check --all -c {{ forgejo_confdir }}' cmd: '{{ forgejo_bindir }}/forgejo doctor check --all -c {{ forgejo_confdir }}'
become: 'yes' become: true
become_user: '{{ forgejo_user }}' become_user: '{{ forgejo_user }}'
register: forgejo_health register: 'forgejo_health'
when: when:
- forgejo_is_installed.rc == 0 - forgejo_is_installed.rc == 0
- gitea_repositories.stat.exists - gitea_repositories.stat.exists
- name: '[UPGRADE] - Display problem message' - name: '[UPGRADE] - Display problem message'
fail: fail:
msg: 'Forgejo doctor detected issues after upgrade task. Please check the instance manually and fix issues before continuing' msg: 'Forgejo doctor detected issues after upgrade task. Please check the instance manually and fix issues before continuing'
when: when:
- forgejo_is_installed.rc == 0 - forgejo_is_installed.rc == 0
- forgejo_health is defined and forgejo_health.rc is defined and forgejo_health.rc != 0 - forgejo_health is defined and forgejo_health.rc is defined and forgejo_health.rc != 0
notify: 'Stop forgejo' notify:
- 'Stop forgejo'

View file

@ -1,19 +1,21 @@
--- ---
- name: "[FORGEJO]- Create user" - name: '[FORGEJO]- Create user'
include_tasks: user.yml include_tasks: 'user.yml'
- name: "[FORGEJO] - configure" - name: '[FORGEJO] - configure'
include_tasks: configure.yml include_tasks: 'configure.yml'
tags: config tags:
- 'config'
- name: "[FORGEJO] - install or upgrade" - name: '[FORGEJO] - install or upgrade'
include_tasks: install_upgrade.yml include_tasks: 'install_upgrade.yml'
- name: "[FORGEJO] - theme" - name: '[FORGEJO] - theme'
include_tasks: custom_themes.yml include_tasks: 'custom_themes.yml'
when: forgejo_custom_themes is defined when: forgejo_custom_themes is defined
tags: theme tags:
- 'theme'
- name: "[FORGEJO] - systemd" - name: '[FORGEJO] - systemd'
include_tasks: systemd.yml include_tasks: 'systemd.yml'

View file

@ -2,23 +2,24 @@
- name: '[SYSTEMD] - Deploy Systemd config' - name: '[SYSTEMD] - Deploy Systemd config'
template: template:
src: etc/systemd/system/forgejo.service.j2 src: 'etc/systemd/system/forgejo.service.j2'
dest: /etc/systemd/system/forgejo.service dest: '/etc/systemd/system/forgejo.service'
owner: root owner: 'root'
group: root group: 'root'
mode: 0644 mode: '0644'
register: forgejo_systemd register: 'forgejo_systemd'
- name: '[SYSTEMD] - Enable systemd' - name: '[SYSTEMD] - Enable systemd'
systemd: systemd:
name: forgejo name: 'forgejo'
enabled: yes enabled: true
state: started state: 'started'
daemon_reload: yes daemon_reload: true
notify: Restart forgejo notify:
- 'Restart forgejo'
- name: "[SYSTEMD] - Daemon-reload" - name: '[SYSTEMD] - Daemon-reload'
systemd: systemd:
daemon_reload: yes daemon_reload: true
name: forgejo name: 'forgejo'
when: forgejo_systemd.changed when: forgejo_systemd.changed

View file

@ -1,12 +1,12 @@
--- ---
- name: Add group - name: '[User] - Add group'
group: group:
name: '{{ forgejo_group }}' name: '{{ forgejo_group }}'
state: present state: 'present'
- name: Add user - name: '[User] - Add user'
user: user:
name: '{{ forgejo_user }}' name: '{{ forgejo_user }}'
shell: /bin/bash shell: '/bin/bash'
group: '{{ forgejo_group }}' group: '{{ forgejo_group }}'

View file

@ -8,6 +8,11 @@
{{ item }} {{ item }}
{% endfor %} {% endfor %}
[oauth2_client]
{% for item in forgejo_oauth2_client_config %}
{{ item }}
{% endfor %}
[ui] [ui]
{% for item in forgejo_ui_config %} {% for item in forgejo_ui_config %}
{{ item }} {{ item }}
@ -65,7 +70,6 @@
{{ item }} {{ item }}
{% endfor %} {% endfor %}
[session] [session]
{% for item in forgejo_session_config %} {% for item in forgejo_session_config %}
{{ item }} {{ item }}