From 265bca3eeb1f77dc02ab85541a3d348797c940da Mon Sep 17 00:00:00 2001 From: L3D Date: Thu, 3 Jun 2021 21:06:04 +0200 Subject: [PATCH] Add custom footer support --- README.md | 13 +++++++++++-- defaults/main.yml | 1 + files/extra_links_footer.tmpl | 2 ++ tasks/customize_footer.yml | 23 +++++++++++++++++++++++ tasks/main.yml | 4 ++++ vars/main.yml | 11 ++++++++++- 6 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 files/extra_links_footer.tmpl create mode 100644 tasks/customize_footer.yml diff --git a/README.md b/README.md index e91afbd..c1134b7 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/defaults/main.yml b/defaults/main.yml index cddd8cf..5f95227 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 diff --git a/files/extra_links_footer.tmpl b/files/extra_links_footer.tmpl new file mode 100644 index 0000000..ac1a2cb --- /dev/null +++ b/files/extra_links_footer.tmpl @@ -0,0 +1,2 @@ +Datenschutz +Impressum diff --git a/tasks/customize_footer.yml b/tasks/customize_footer.yml new file mode 100644 index 0000000..694b952 --- /dev/null +++ b/tasks/customize_footer.yml @@ -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" diff --git a/tasks/main.yml b/tasks/main.yml index cd78226..797cba8 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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 diff --git a/vars/main.yml b/vars/main.yml index c223ce1..857cc45 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -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'