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``
|
||||
- Create a directory with the files you want to deploy.
|
||||
- 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
|
||||
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
|
||||
tags: skip_ansible_lint
|
||||
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
|
||||
ansible.builtin.include_tasks:
|
||||
file: 'versioncheck.yml'
|
||||
file: "versioncheck.yml"
|
||||
when: submodules_versioncheck|bool
|
||||
|
||||
- name: Gather installed packages for checks later on
|
||||
ansible.builtin.package_facts:
|
||||
manager: 'auto'
|
||||
manager: "auto"
|
||||
|
||||
- name: Prepare gitea/forgejo variable import
|
||||
block:
|
||||
|
@ -28,12 +28,12 @@
|
|||
|
||||
- name: Backup gitea before update
|
||||
ansible.builtin.include_tasks:
|
||||
file: 'backup.yml'
|
||||
file: "backup.yml"
|
||||
when: gitea_backup_on_upgrade|bool
|
||||
|
||||
- name: Create gitea user and group
|
||||
ansible.builtin.include_tasks:
|
||||
file: 'create_user.yml'
|
||||
file: "create_user.yml"
|
||||
|
||||
- name: "Install or update {{ gitea_fork }}"
|
||||
ansible.builtin.include_tasks:
|
||||
|
@ -41,41 +41,41 @@
|
|||
|
||||
- name: Create directories
|
||||
ansible.builtin.include_tasks:
|
||||
file: 'directory.yml'
|
||||
file: "directory.yml"
|
||||
|
||||
- name: Setup gitea systemd service
|
||||
ansible.builtin.include_tasks:
|
||||
file: 'install_systemd.yml'
|
||||
file: "install_systemd.yml"
|
||||
when: ansible_service_mgr == "systemd"
|
||||
|
||||
- name: Generate JWT Secrets if undefined
|
||||
ansible.builtin.include_tasks:
|
||||
file: 'jwt_secrets.yml'
|
||||
file: "jwt_secrets.yml"
|
||||
|
||||
- name: Generate gitea secrets if undefined
|
||||
ansible.builtin.include_tasks:
|
||||
file: 'gitea_secrets.yml'
|
||||
file: "gitea_secrets.yml"
|
||||
|
||||
- name: Configure gitea
|
||||
ansible.builtin.include_tasks:
|
||||
file: 'configure.yml'
|
||||
file: "configure.yml"
|
||||
|
||||
- name: Deploy optional fail2ban rules
|
||||
ansible.builtin.include_tasks:
|
||||
file: 'fail2ban.yml'
|
||||
file: "fail2ban.yml"
|
||||
when: gitea_fail2ban_enabled | bool
|
||||
|
||||
- name: Optionally customize gitea
|
||||
ansible.builtin.include_tasks:
|
||||
file: 'customize_logo.yml'
|
||||
file: "customize_logo.yml"
|
||||
when: gitea_customize_logo | bool
|
||||
|
||||
- name: Optionally customize footer
|
||||
ansible.builtin.include_tasks:
|
||||
file: 'customize_footer.yml'
|
||||
file: "customize_footer.yml"
|
||||
when: gitea_customize_footer | bool
|
||||
|
||||
- name: Optionally deploy public files
|
||||
ansible.builtin.include_tasks:
|
||||
file: 'customize_public_files.yml'
|
||||
when: gitea_customize_files | bool
|
||||
file: "customize_public_files.yml"
|
||||
when: gitea_customize_files | bool or gitea_custom_themes is defined
|
||||
|
|
Loading…
Reference in a new issue