From b898edfd4874287048cf596ec54340ca5096aea3 Mon Sep 17 00:00:00 2001 From: L3D Date: Thu, 3 Jun 2021 22:51:28 +0200 Subject: [PATCH] allow optional public files --- README.md | 5 ++++- defaults/main.yml | 2 ++ tasks/customize_public_files.yml | 23 +++++++++++++++++++++++ tasks/main.yml | 4 ++++ vars/main.yml | 3 +-- 5 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 tasks/customize_public_files.yml diff --git a/README.md b/README.md index c76e952..34a0ebf 100644 --- a/README.md +++ b/README.md @@ -236,7 +236,10 @@ To deploy multiple files we created the ``gitea_custom_search`` variable, that c * "files/{{ gitea_http_domain }}/gitea_footer/extra_links_footer.tmpl" * 'files/gitea_footer/extra_links_footer.tmpl' * 'files/extra_links_footer.tmpl' - ++ **CUSTOM FILES**: + - 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/``)* ## 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 e834622..aa54ef2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -153,3 +153,5 @@ gitea_custom_search: "files/host_files/{{ inventory_hostname }}/gitea" gitea_customize_logo: false gitea_custom: "{{ gitea_home }}/custom" gitea_customize_footer: false +gitea_customize_files: false +gitea_customize_files_path: "{{ gitea_custom_search }}/gitea_files" diff --git a/tasks/customize_public_files.yml b/tasks/customize_public_files.yml new file mode 100644 index 0000000..2ae41dd --- /dev/null +++ b/tasks/customize_public_files.yml @@ -0,0 +1,23 @@ +--- +- name: create public directory for custom public web files + 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" + +- name: transfer custom public web data + become: true + ansible.builtin.copy: + src: "{{ gitea_customize_files_path }}" + dest: "{{ gitea_custom }}/public/" + owner: "{{ gitea_user }}" + group: "{{ gitea_group }}" + directory_mode: true + mode: 'u=rwX,g=rX,o=' + ignore_errors: true + notify: "Restart gitea" diff --git a/tasks/main.yml b/tasks/main.yml index 797cba8..5a96d87 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -56,3 +56,7 @@ - name: optionally customize footer ansible.builtin.include_tasks: customize_footer.yml when: gitea_customize_footer|bool + +- name: optionally deploy public files + ansible.builtin.include_tasks: customize_public_files.yml + when: gitea_customize_files|bool diff --git a/vars/main.yml b/vars/main.yml index 857cc45..0331497 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -56,6 +56,5 @@ transfer_custom_footer: - 'files/gitea_footer/extra_links_footer.tmpl' - 'files/extra_links_footer.tmpl' - -playbook_version_number: 17 # should be int +playbook_version_number: 18 # should be int playbook_version_path: 'do1jlr.gitea.version'