add possibility to deploy custom theme

This commit is contained in:
meaz 2023-02-18 09:50:48 +01:00
parent a3f9c2efc1
commit 2776d223fb
Signed by: meaz
GPG key ID: CD7A47B2F1ED43B4
4 changed files with 64 additions and 0 deletions

View file

@ -24,3 +24,5 @@ gitea_download_url: 'https://github.com/go-gitea/gitea/releases/download/v{{ git
## 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.
## Customization
Check https://docs.gitea.io/en-us/customizing-gitea/

View file

@ -11,6 +11,12 @@ gitea_version: '1.18.3-0'
gitea_arch: 'linux-amd64'
#gitea_download_url: 'https://github.com/go-gitea/gitea/releases/download/v{{ gitea_version }}/gitea-{{ gitea_version }}-{{ gitea_arch }}'
gitea_theme_dir: '{{ gitea_lib_dir }}/custom'
gitea_custom_themes:
- name: '' #add name of the theme
repo: '' #add git repository of the theme
img: '' #set it to true if there is an img foler
#[CONFIG]
# App.ini file variables

51
tasks/custom_themes.yml Normal file
View file

@ -0,0 +1,51 @@
---
- name: '[THEME] - Create public dir'
file:
path: '{{ gitea_lib_dir }}/custom/public/'
state: directory
owner: "{{ gitea_user }}"
group: "{{ gitea_group }}"
tags: theme
- name: "[THEME] - Get repo"
git:
repo: "{{ item.repo }}"
dest: "{{ gitea_theme_dir }}/{{ item.name }}"
loop: "{{ gitea_custom_themes }}"
tags: theme
- name: "[THEME] - Sync css folder"
synchronize:
src: "{{ gitea_theme_dir }}/{{ item.name }}/css/"
dest: "{{ gitea_lib_dir }}/custom/public/css"
owner: yes
group: yes
recursive: yes
delete: false
delegate_to: "{{ inventory_hostname }}"
loop: "{{ gitea_custom_themes }}"
tags: theme
- name: "[THEME] - Sync img folder"
synchronize:
src: "{{ gitea_theme_dir }}/{{ item.name }}/img/"
dest: "{{ gitea_lib_dir }}/custom/public/img"
owner: yes
group: yes
recursive: yes
delete: false
delegate_to: "{{ inventory_hostname }}"
when: item.img == "true"
loop: "{{ gitea_custom_themes }}"
tags: theme
- name: "[THEME] - Change repo ownership"
file:
path: "{{ gitea_lib_dir }}/custom"
state: directory
recurse: yes
owner: "{{ gitea_user }}"
group: "{{ gitea_group }}"
tags: theme

View file

@ -5,6 +5,11 @@
- name: "[GITEA] - configure"
include_tasks: configure.yml
tags: config
- name: "[GITEA] - theme"
include_tasks: custom_themes.yml
tags: theme
- name: "[GITEA] - systemd"
include_tasks: systemd.yml