Add custom footer support

This commit is contained in:
L3D 2021-06-03 21:06:04 +02:00
parent 0fc5aaae7d
commit 265bca3eeb
No known key found for this signature in database
GPG Key ID: CD08445BFF4313D1
6 changed files with 51 additions and 3 deletions

View File

@ -215,9 +215,9 @@ As this will only deploy config files, fail2ban already has to be installed or o
### 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"``.
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
+ **LOGO**:
- Set ``gitea_customize_logo`` to ``true``
- We search for:
* ``logo.svg`` - Used for favicon, site icon, app icon
@ -229,6 +229,15 @@ To deploy multiple files we created the ``gitea_custom_search`` variable, that c
* ``files/{{ inventory_hostname }}/gitea_logo/``
* ``files/{{ gitea_http_domain }}/gitea_logo/``
* ``files/gitea_logo/``
+ **FOOTER**:
- Set ``gitea_customize_footer`` to ``true``
- We Search using first_found in:
* "{{ gitea_custom_search }}/gitea_footer/extra_links_footer.tmpl"
* "files/{{ inventory_hostname }}/gitea_footer/extra_links_footer.tmpl"
* "files/{{ gitea_http_domain }}/gitea_footer/extra_links_footer.tmpl"
* 'files/gitea_footer/extra_links_footer.tmpl'
* 'files/extra_links_footer.tmpl'
## Contributing
Don't hesitate to create a pull request, and when in doubt you can reach me on

View File

@ -151,3 +151,4 @@ gitea_fail2ban_jail_action: 'iptables-allports'
gitea_custom_search: "files/host_files/{{ inventory_hostname }}/gitea"
gitea_customize_logo: false
gitea_custom: "{{ gitea_home }}/custom"
gitea_customize_footer: false

View File

@ -0,0 +1,2 @@
<a class="item" href="{{AppSubUrl}}/datenschutz.html">Datenschutz</a>
<a class="item" href="{{AppSubUrl}}/impressum.html">Impressum</a>

View File

@ -0,0 +1,23 @@
---
- name: create directory for custom footer
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 }}/templates"
- "{{ gitea_custom }}/templates/custom"
- name: transfer custom footer template
become: true
ansible.builtin.copy:
src: "{{ lookup('first_found', transfer_custom_footer) }}"
dest: "{{ gitea_custom }}/templates/custom/extra_links_footer.tmpl"
owner: "{{ gitea_user }}"
group: "{{ gitea_group }}"
mode: '0644'
ignore_errors: true
notify: "Restart gitea"

View File

@ -52,3 +52,7 @@
- name: optionally customize gitea
ansible.builtin.include_tasks: customize_logo.yml
when: gitea_customize_logo|bool
- name: optionally customize footer
ansible.builtin.include_tasks: customize_footer.yml
when: gitea_customize_footer|bool

View File

@ -48,5 +48,14 @@ transfer_custom_logo_appletouchiconpng:
- "files/{{ gitea_http_domain }}/gitea_logo/apple-touch-icon.png"
- 'files/gitea_logo/apple-touch-icon.png'
playbook_version_number: 16 # should be int
transfer_custom_footer:
files:
- "{{ gitea_custom_search }}/gitea_footer/extra_links_footer.tmpl"
- "files/{{ inventory_hostname }}/gitea_footer/extra_links_footer.tmpl"
- "files/{{ gitea_http_domain }}/gitea_footer/extra_links_footer.tmpl"
- 'files/gitea_footer/extra_links_footer.tmpl'
- 'files/extra_links_footer.tmpl'
playbook_version_number: 17 # should be int
playbook_version_path: 'do1jlr.gitea.version'