From a2be96d8d19ed73fd48be88ad76671ae44d8ebec Mon Sep 17 00:00:00 2001 From: L3D Date: Sat, 21 Sep 2024 16:16:54 +0200 Subject: [PATCH 1/3] Pretify --- tasks/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index d5cb664..baf3cfe 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -2,7 +2,7 @@ - name: Perform optional versionscheck ansible.builtin.include_tasks: file: "versioncheck.yml" - when: submodules_versioncheck|bool + when: submodules_versioncheck | bool - name: Gather installed packages for checks later on ansible.builtin.package_facts: @@ -19,7 +19,8 @@ msg: "Currently only {{ gitea_supported_forks }} are supported." - name: Gather Gitea/Forgejo UI Theme variables - ansible.builtin.include_vars: "{{ lookup('ansible.builtin.first_found', params) }}" + ansible.builtin.include_vars: + file: "{{ lookup('ansible.builtin.first_found', params) }}" vars: params: files: From 411a97cec4e9c9275aa88982d963162c99c7d611 Mon Sep 17 00:00:00 2001 From: L3D Date: Sun, 22 Sep 2024 13:11:21 +0200 Subject: [PATCH 2/3] Improve for presentation --- handlers/main.yml | 1 + tasks/configure.yml | 4 ++-- tasks/customize_footer.yml | 2 +- tasks/customize_public_files.yml | 4 ++-- tasks/install_forgejo.yml | 2 +- tasks/install_gitea.yml | 2 +- tasks/install_systemd.yml | 4 ++-- tasks/main.yml | 9 +++++---- tasks/set_forgejo_version.yml | 4 +++- tasks/set_gitea_version.yml | 4 +++- 10 files changed, 21 insertions(+), 15 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index ebc1716..ac0d058 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,6 +1,7 @@ --- - name: "Restart gitea" become: true + listen: "systemctl restart gitea" ansible.builtin.service: name: gitea state: restarted diff --git a/tasks/configure.yml b/tasks/configure.yml index d04406c..01f81c6 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -10,12 +10,12 @@ - name: "Configure gitea" become: true ansible.builtin.template: - src: gitea.ini.j2 + src: 'templates/gitea.ini.j2' dest: "{{ gitea_configuration_path }}/gitea.ini" owner: "{{ gitea_user }}" group: "{{ gitea_group }}" mode: '0640' - notify: "Restart gitea" + notify: "systemctl restart gitea" - name: "Service gitea" become: true diff --git a/tasks/customize_footer.yml b/tasks/customize_footer.yml index ccf0478..9cc967d 100644 --- a/tasks/customize_footer.yml +++ b/tasks/customize_footer.yml @@ -21,4 +21,4 @@ mode: '0640' failed_when: false tags: skip_ansible_lint - notify: "Restart gitea" + notify: "systemctl restart gitea" diff --git a/tasks/customize_public_files.yml b/tasks/customize_public_files.yml index f092522..469bd3b 100644 --- a/tasks/customize_public_files.yml +++ b/tasks/customize_public_files.yml @@ -21,7 +21,7 @@ mode: "u=rwX,g=rX,o=" failed_when: false tags: skip_ansible_lint - notify: "Restart gitea" + notify: "systemctl restart gitea" - name: Create css directory for custom themes when: gitea_custom_themes is defined @@ -41,4 +41,4 @@ group: "{{ gitea_group }}" mode: "u=rwX,g=rX,o=" loop: "{{ gitea_custom_themes }}" - notify: "Restart gitea" + notify: "systemctl restart gitea" diff --git a/tasks/install_forgejo.yml b/tasks/install_forgejo.yml index 6cbb79e..421dfcf 100644 --- a/tasks/install_forgejo.yml +++ b/tasks/install_forgejo.yml @@ -80,4 +80,4 @@ mode: 0755 owner: root group: root - notify: "Restart gitea" + notify: "systemctl restart gitea" diff --git a/tasks/install_gitea.yml b/tasks/install_gitea.yml index 4a7f5c4..65f4403 100644 --- a/tasks/install_gitea.yml +++ b/tasks/install_gitea.yml @@ -84,4 +84,4 @@ mode: 0755 owner: root group: root - notify: "Restart gitea" + notify: "systemctl restart gitea" diff --git a/tasks/install_systemd.yml b/tasks/install_systemd.yml index 6a441cb..9e249d4 100644 --- a/tasks/install_systemd.yml +++ b/tasks/install_systemd.yml @@ -2,14 +2,14 @@ - name: "Setup systemd service" become: true ansible.builtin.template: - src: gitea.service.j2 + src: 'templates/gitea.service.j2' dest: "{{ gitea_systemd_path }}/gitea.service" owner: root group: root mode: 0644 notify: - "Reload systemd" - - "Restart gitea" + - "systemctl restart gitea" - name: "Reload systemd" become: true diff --git a/tasks/main.yml b/tasks/main.yml index baf3cfe..4efed83 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -10,13 +10,14 @@ - name: Prepare gitea/forgejo variable import block: - - name: Gather variables for gitea or forgejo + - name: Gather vars for gitea or forgejo ansible.builtin.include_vars: - file: "{{ lookup('ansible.builtin.first_found', gitea_fork_variables) }}" + file: "{{ lookup('ansible.builtin.first_found', + gitea_fork_variables) }}" rescue: - - name: Gitea/Forejo import info + - name: Gitea/Forgejo import info ansible.builtin.fail: - msg: "Currently only {{ gitea_supported_forks }} are supported." + msg: "Only {{ gitea_supported_forks }} are supported." - name: Gather Gitea/Forgejo UI Theme variables ansible.builtin.include_vars: diff --git a/tasks/set_forgejo_version.yml b/tasks/set_forgejo_version.yml index 7e04788..7184b48 100644 --- a/tasks/set_forgejo_version.yml +++ b/tasks/set_forgejo_version.yml @@ -1,6 +1,8 @@ --- - name: "Check forgejo installed version" - ansible.builtin.shell: "set -eo pipefail; {{ gitea_full_executable_path }} -v | cut -d' ' -f 3" + ansible.builtin.shell: | + set -eo pipefail + {{ gitea_full_executable_path }} -v | cut -d' ' -f 3 args: executable: '/bin/bash' register: gitea_active_version diff --git a/tasks/set_gitea_version.yml b/tasks/set_gitea_version.yml index 0c9880b..f36859e 100644 --- a/tasks/set_gitea_version.yml +++ b/tasks/set_gitea_version.yml @@ -1,6 +1,8 @@ --- - name: "Check gitea installed version" - ansible.builtin.shell: "set -eo pipefail; {{ gitea_full_executable_path }} -v | cut -d' ' -f 3" + ansible.builtin.shell: | + set -eo pipefail + {{ gitea_full_executable_path }} -v | cut -d' ' -f 3 args: executable: /bin/bash register: gitea_active_version From a18111aceedeb79b7f557fc9e194c2ff5f1c8285 Mon Sep 17 00:00:00 2001 From: L3D Date: Sun, 22 Sep 2024 13:37:54 +0200 Subject: [PATCH 3/3] Improve gitea --- handlers/main.yml | 6 +++--- tasks/backup.yml | 4 ++-- tasks/configure.yml | 2 +- tasks/install_systemd.yml | 2 +- vars/main.yml | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index ac0d058..e365e4e 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -2,20 +2,20 @@ - name: "Restart gitea" become: true listen: "systemctl restart gitea" - ansible.builtin.service: + ansible.builtin.systemd_service: name: gitea state: restarted when: ansible_service_mgr == "systemd" - name: "Reload systemd" become: true - ansible.builtin.systemd: + ansible.builtin.systemd_service: daemon_reload: true when: ansible_service_mgr == "systemd" - name: "Systemctl restart fail2ban" become: true - ansible.builtin.systemd: + ansible.builtin.systemd_service: name: fail2ban state: restarted when: ansible_service_mgr == "systemd" diff --git a/tasks/backup.yml b/tasks/backup.yml index 6a9fc56..1766be7 100644 --- a/tasks/backup.yml +++ b/tasks/backup.yml @@ -10,7 +10,7 @@ block: - name: Stopping gitea before upgrade become: true - ansible.builtin.systemd: + ansible.builtin.systemd_service: name: 'gitea.service' state: 'stopped' when: ansible_service_mgr == "systemd" @@ -33,7 +33,7 @@ rescue: - name: Starting gitea because backup failed become: true - ansible.builtin.systemd: + ansible.builtin.systemd_service: name: 'gitea.service' state: 'started' when: ansible_service_mgr == "systemd" diff --git a/tasks/configure.yml b/tasks/configure.yml index 01f81c6..60b5703 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -19,7 +19,7 @@ - name: "Service gitea" become: true - ansible.builtin.systemd: + ansible.builtin.systemd_service: name: gitea state: started enabled: true diff --git a/tasks/install_systemd.yml b/tasks/install_systemd.yml index 9e249d4..97007a4 100644 --- a/tasks/install_systemd.yml +++ b/tasks/install_systemd.yml @@ -13,5 +13,5 @@ - name: "Reload systemd" become: true - ansible.builtin.systemd: + ansible.builtin.systemd_service: daemon_reload: true diff --git a/vars/main.yml b/vars/main.yml index ffb5179..ffa4a30 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -63,5 +63,5 @@ transfer_custom_footer: - 'files/gitea_footer/extra_links_footer.tmpl' - 'files/extra_links_footer.tmpl' -playbook_version_number: 61 +playbook_version_number: 62 playbook_version_path: 'do1jlr.gitea.version'