mirror of
https://github.com/roles-ansible/ansible_role_gitea.git
synced 2024-08-16 11:39:50 +02:00
implement custom logos
This commit is contained in:
parent
2fbcfb5483
commit
e27ef27706
7 changed files with 111 additions and 5 deletions
17
README.md
17
README.md
|
@ -213,6 +213,23 @@ As this will only deploy config files, fail2ban already has to be installed or o
|
|||
| `gitea_fail2ban_jail_bantime` | `900` | fail2ban jail `bantime` setting. |
|
||||
| `gitea_fail2ban_jail_action` | `iptables-allports` | fail2ban jail `action` setting. |
|
||||
|
||||
### optional customisation
|
||||
You can optionally customize your gitea using this ansible role. We got our information about customisation from [docs.gitea.io/en-us/customizing-gitea](https://docs.gitea.io/en-us/customizing-gitea/).
|
||||
To deploy multiple files we created the ``gitea_custom_search`` variable, that can point to the path where you put the custom gitea files *( default ``"files/host_files/{{ inventory_hostname }}/gitea"``.
|
||||
|
||||
+ LOGO
|
||||
- Set ``gitea_customize_logo`` to ``true``
|
||||
- We search for:
|
||||
* ``logo.svg`` - Used for favicon, site icon, app icon
|
||||
* ``logo.png`` - Used for Open Graph
|
||||
* ``favicon.png`` - Used as fallback for browsers that don’t support SVG favicons
|
||||
* ``apple-touch-icon.png`` - Used on iOS devices for bookmarks
|
||||
- We search in *(using [first_found](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/first_found_lookup.html))*:
|
||||
* ``{{ gitea_custom_search }}/gitea_logo/``
|
||||
* ``files/{{ inventory_hostname }}/gitea_logo/``
|
||||
* ``files/{{ gitea_http_domain }}/gitea_logo/``
|
||||
* ``files/gitea_logo/``
|
||||
|
||||
## Contributing
|
||||
Don't hesitate to create a pull request, and when in doubt you can reach me on
|
||||
Mastodon [@l3d@chaos.social](https://chaos.social/@l3d).
|
||||
|
|
|
@ -146,3 +146,8 @@ gitea_fail2ban_jail_maxretry: '10'
|
|||
gitea_fail2ban_jail_findtime: '3600'
|
||||
gitea_fail2ban_jail_bantime: '900'
|
||||
gitea_fail2ban_jail_action: 'iptables-allports'
|
||||
|
||||
# gitea customisation
|
||||
gitea_custom_search: "files/host_files/{{ inventory_hostname }}/gitea"
|
||||
gitea_customize_logo: false
|
||||
gitea_custom: "{{ gitea_home }}/custom"
|
||||
|
|
52
tasks/customize_logo.yml
Normal file
52
tasks/customize_logo.yml
Normal file
|
@ -0,0 +1,52 @@
|
|||
---
|
||||
- name: create directory for custom logos
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: "{{ gitea_user }}"
|
||||
group: "{{ gitea_group }}"
|
||||
mode: 'u=rwX,g=rX,o='
|
||||
with_items:
|
||||
- "{{ gitea_custom }}/public"
|
||||
- "{{ gitea_custom }}/public/img"
|
||||
|
||||
- name: transfer custom logo.svg
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
src: "{{ lookup('first_found', transfer_custom_logo_logosvg) }}"
|
||||
dest: "{{ gitea_custom }}/public/img/logo.svg"
|
||||
owner: "{{ gitea_user }}"
|
||||
group: "{{ gitea_group }}"
|
||||
mode: '0644'
|
||||
ignore_errors: true
|
||||
|
||||
- name: transfer custom logo.png
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
src: "{{ lookup('first_found', transfer_custom_logo_logopng) }}"
|
||||
dest: "{{ gitea_custom }}/public/img/logo.png"
|
||||
owner: "{{ gitea_user }}"
|
||||
group: "{{ gitea_group }}"
|
||||
mode: '0644'
|
||||
ignore_errors: true
|
||||
|
||||
- name: transfer custom favicon.png
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
src: "{{ lookup('first_found', transfer_custom_logo_faviconpng) }}"
|
||||
dest: "{{ gitea_custom }}/public/img/favicon.png"
|
||||
owner: "{{ gitea_user }}"
|
||||
group: "{{ gitea_group }}"
|
||||
mode: '0644'
|
||||
ignore_errors: true
|
||||
|
||||
- name: transfer custom apple-touch-icon.png
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
src: "{{ lookup('first_found', transfer_custom_logo_appletouchiconpng) }}"
|
||||
dest: "{{ gitea_custom }}/public/img/apple-touch-icon.png"
|
||||
owner: "{{ gitea_user }}"
|
||||
group: "{{ gitea_group }}"
|
||||
mode: '0644'
|
||||
ignore_errors: true
|
|
@ -11,9 +11,9 @@
|
|||
- "/etc/gitea"
|
||||
- "{{ gitea_home }}"
|
||||
- "{{ gitea_home }}/data"
|
||||
- "{{ gitea_home }}/custom"
|
||||
- "{{ gitea_home }}/custom/https"
|
||||
- "{{ gitea_home }}/custom/mailer"
|
||||
- "{{ gitea_custom }}"
|
||||
- "{{ gitea_custom }}/https"
|
||||
- "{{ gitea_custom }}/mailer"
|
||||
- "{{ gitea_home }}/indexers"
|
||||
- "{{ gitea_home }}/log"
|
||||
- "{{ gitea_repository_root }}"
|
||||
|
|
|
@ -48,3 +48,7 @@
|
|||
- name: deploy optional fail2ban rules
|
||||
ansible.builtin.include_tasks: fail2ban.yml
|
||||
when: gitea_fail2ban_enabled|bool
|
||||
|
||||
- name: optionally customize gitea
|
||||
ansible.builtin.include_tasks: customize_logo.yml
|
||||
when: gitea_customize_logo|bool
|
||||
|
|
|
@ -5,7 +5,7 @@ After=network.target
|
|||
[Service]
|
||||
User={{ gitea_user }}
|
||||
Group={{ gitea_group }}
|
||||
ExecStart=/usr/local/bin/gitea web -c /etc/gitea/gitea.ini --custom-path {{ gitea_home }}/custom/
|
||||
ExecStart=/usr/local/bin/gitea web -c /etc/gitea/gitea.ini --custom-path {{ gitea_custom }}/
|
||||
Restart=on-failure
|
||||
WorkingDirectory={{ gitea_home }}
|
||||
{% if gitea_systemd_cap_net_bind_service %}
|
||||
|
|
|
@ -20,5 +20,33 @@ gitea_variables:
|
|||
paths:
|
||||
- 'vars'
|
||||
|
||||
playbook_version_number: 15 # should be int
|
||||
transfer_custom_logo_logosvg:
|
||||
files:
|
||||
- "{{ gitea_custom_search }}/gitea_logo/logo.svg"
|
||||
- "files/{{ inventory_hostname }}/gitea_logo/logo.svg"
|
||||
- "files/{{ gitea_http_domain }}/gitea_logo/logo.svg"
|
||||
- 'files/gitea_logo/logo.svg'
|
||||
|
||||
transfer_custom_logo_logopng:
|
||||
files:
|
||||
- "{{ gitea_custom_search }}/gitea_logo/logo.png"
|
||||
- "files/{{ inventory_hostname }}/gitea_logo/logo.png"
|
||||
- "files/{{ gitea_http_domain }}/gitea_logo/logo.png"
|
||||
- 'files/gitea_logo/logo.png'
|
||||
|
||||
transfer_custom_logo_faviconpng:
|
||||
files:
|
||||
- "{{ gitea_custom_search }}/gitea_logo/favicon.png"
|
||||
- "files/{{ inventory_hostname }}/gitea_logo/favicon.png"
|
||||
- "files/{{ gitea_http_domain }}/gitea_logo/favicon.png"
|
||||
- 'files/gitea_logo/favicon.png'
|
||||
|
||||
transfer_custom_logo_appletouchiconpng:
|
||||
files:
|
||||
- "{{ gitea_custom_search }}/gitea_logo/apple-touch-icon.png"
|
||||
- "files/{{ inventory_hostname }}/gitea_logo/apple-touch-icon.png"
|
||||
- "files/{{ gitea_http_domain }}/gitea_logo/apple-touch-icon.png"
|
||||
- 'files/gitea_logo/apple-touch-icon.png'
|
||||
|
||||
playbook_version_number: 16 # should be int
|
||||
playbook_version_path: 'do1jlr.gitea.version'
|
||||
|
|
Loading…
Reference in a new issue