mirror of
https://github.com/roles-ansible/ansible_role_gitea.git
synced 2024-08-16 11:39:50 +02:00
Merge pull request #149 from pat-s/custom-themes-feat
Feature: allow adding custom themes dynamically
This commit is contained in:
commit
b2d64105ae
3 changed files with 43 additions and 14 deletions
|
@ -406,6 +406,15 @@ To deploy multiple files we created the ``gitea_custom_search`` variable, that c
|
||||||
- Set ``gitea_customize_files`` to ``true``
|
- Set ``gitea_customize_files`` to ``true``
|
||||||
- Create a directory with the files you want to deploy.
|
- Create a directory with the files you want to deploy.
|
||||||
- Point ``gitea_customize_files_path`` to this directory. *(Default ``{{ gitea_custom_search }}/gitea_files/``)*
|
- Point ``gitea_customize_files_path`` to this directory. *(Default ``{{ gitea_custom_search }}/gitea_files/``)*
|
||||||
|
+ **CUSTOM THEMES**:
|
||||||
|
- Set `gitea_custom_themes` to a list with URLs for custom theme CSS files. You usually want three individual files per theme. Example:
|
||||||
|
```yaml
|
||||||
|
gitea_custom_themes:
|
||||||
|
- https://example.com/theme-custom-auto.css
|
||||||
|
- https://example.com/theme-custom-dark.css
|
||||||
|
- https://example.com/theme-custom-light.css
|
||||||
|
```
|
||||||
|
- Set `gitea_themes` variable and include the names of the new themes. To keep the existing ones, you need to pass all themes names, e.g. `auto,gitea,arc-green,<custom-auto>,<custom-light>,<custom-dark>`
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
This role uses the ``ansible.builtin`` and ``community.general`` ansible Collections. To download the latest forgejo/gitea release we use json_query. This requires ``jmespath`` to be available.
|
This role uses the ``ansible.builtin`` and ``community.general`` ansible Collections. To download the latest forgejo/gitea release we use json_query. This requires ``jmespath`` to be available.
|
||||||
|
|
|
@ -22,3 +22,23 @@
|
||||||
failed_when: false
|
failed_when: false
|
||||||
tags: skip_ansible_lint
|
tags: skip_ansible_lint
|
||||||
notify: "Restart gitea"
|
notify: "Restart gitea"
|
||||||
|
|
||||||
|
- name: Create css directory for custom themes
|
||||||
|
when: gitea_custom_themes is defined
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ gitea_custom }}/public/css"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ gitea_user }}"
|
||||||
|
group: "{{ gitea_group }}"
|
||||||
|
mode: "u=rwX,g=rX,o="
|
||||||
|
|
||||||
|
- name: Get custom themes
|
||||||
|
when: gitea_custom_themes is defined
|
||||||
|
ansible.builtin.get_url:
|
||||||
|
url: "{{ item.name }}"
|
||||||
|
dest: "{{ gitea_custom }}/css/{{ item.name | basename }}"
|
||||||
|
owner: "{{ gitea_user }}"
|
||||||
|
group: "{{ gitea_group }}"
|
||||||
|
mode: "u=rwX,g=rX,o="
|
||||||
|
loop: "{{ gitea_custom_themes }}"
|
||||||
|
notify: "Restart gitea"
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
---
|
---
|
||||||
- name: Perform optional versionscheck
|
- name: Perform optional versionscheck
|
||||||
ansible.builtin.include_tasks:
|
ansible.builtin.include_tasks:
|
||||||
file: 'versioncheck.yml'
|
file: "versioncheck.yml"
|
||||||
when: submodules_versioncheck|bool
|
when: submodules_versioncheck|bool
|
||||||
|
|
||||||
- name: Gather installed packages for checks later on
|
- name: Gather installed packages for checks later on
|
||||||
ansible.builtin.package_facts:
|
ansible.builtin.package_facts:
|
||||||
manager: 'auto'
|
manager: "auto"
|
||||||
|
|
||||||
- name: Prepare gitea/forgejo variable import
|
- name: Prepare gitea/forgejo variable import
|
||||||
block:
|
block:
|
||||||
|
@ -28,12 +28,12 @@
|
||||||
|
|
||||||
- name: Backup gitea before update
|
- name: Backup gitea before update
|
||||||
ansible.builtin.include_tasks:
|
ansible.builtin.include_tasks:
|
||||||
file: 'backup.yml'
|
file: "backup.yml"
|
||||||
when: gitea_backup_on_upgrade|bool
|
when: gitea_backup_on_upgrade|bool
|
||||||
|
|
||||||
- name: Create gitea user and group
|
- name: Create gitea user and group
|
||||||
ansible.builtin.include_tasks:
|
ansible.builtin.include_tasks:
|
||||||
file: 'create_user.yml'
|
file: "create_user.yml"
|
||||||
|
|
||||||
- name: "Install or update {{ gitea_fork }}"
|
- name: "Install or update {{ gitea_fork }}"
|
||||||
ansible.builtin.include_tasks:
|
ansible.builtin.include_tasks:
|
||||||
|
@ -41,41 +41,41 @@
|
||||||
|
|
||||||
- name: Create directories
|
- name: Create directories
|
||||||
ansible.builtin.include_tasks:
|
ansible.builtin.include_tasks:
|
||||||
file: 'directory.yml'
|
file: "directory.yml"
|
||||||
|
|
||||||
- name: Setup gitea systemd service
|
- name: Setup gitea systemd service
|
||||||
ansible.builtin.include_tasks:
|
ansible.builtin.include_tasks:
|
||||||
file: 'install_systemd.yml'
|
file: "install_systemd.yml"
|
||||||
when: ansible_service_mgr == "systemd"
|
when: ansible_service_mgr == "systemd"
|
||||||
|
|
||||||
- name: Generate JWT Secrets if undefined
|
- name: Generate JWT Secrets if undefined
|
||||||
ansible.builtin.include_tasks:
|
ansible.builtin.include_tasks:
|
||||||
file: 'jwt_secrets.yml'
|
file: "jwt_secrets.yml"
|
||||||
|
|
||||||
- name: Generate gitea secrets if undefined
|
- name: Generate gitea secrets if undefined
|
||||||
ansible.builtin.include_tasks:
|
ansible.builtin.include_tasks:
|
||||||
file: 'gitea_secrets.yml'
|
file: "gitea_secrets.yml"
|
||||||
|
|
||||||
- name: Configure gitea
|
- name: Configure gitea
|
||||||
ansible.builtin.include_tasks:
|
ansible.builtin.include_tasks:
|
||||||
file: 'configure.yml'
|
file: "configure.yml"
|
||||||
|
|
||||||
- name: Deploy optional fail2ban rules
|
- name: Deploy optional fail2ban rules
|
||||||
ansible.builtin.include_tasks:
|
ansible.builtin.include_tasks:
|
||||||
file: 'fail2ban.yml'
|
file: "fail2ban.yml"
|
||||||
when: gitea_fail2ban_enabled | bool
|
when: gitea_fail2ban_enabled | bool
|
||||||
|
|
||||||
- name: Optionally customize gitea
|
- name: Optionally customize gitea
|
||||||
ansible.builtin.include_tasks:
|
ansible.builtin.include_tasks:
|
||||||
file: 'customize_logo.yml'
|
file: "customize_logo.yml"
|
||||||
when: gitea_customize_logo | bool
|
when: gitea_customize_logo | bool
|
||||||
|
|
||||||
- name: Optionally customize footer
|
- name: Optionally customize footer
|
||||||
ansible.builtin.include_tasks:
|
ansible.builtin.include_tasks:
|
||||||
file: 'customize_footer.yml'
|
file: "customize_footer.yml"
|
||||||
when: gitea_customize_footer | bool
|
when: gitea_customize_footer | bool
|
||||||
|
|
||||||
- name: Optionally deploy public files
|
- name: Optionally deploy public files
|
||||||
ansible.builtin.include_tasks:
|
ansible.builtin.include_tasks:
|
||||||
file: 'customize_public_files.yml'
|
file: "customize_public_files.yml"
|
||||||
when: gitea_customize_files | bool
|
when: gitea_customize_files | bool or gitea_custom_themes is defined
|
||||||
|
|
Loading…
Reference in a new issue