diff --git a/handlers/main.yml b/handlers/main.yml index ebc1716..e365e4e 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,20 +1,21 @@ --- - name: "Restart gitea" become: true - ansible.builtin.service: + listen: "systemctl restart gitea" + 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 d04406c..60b5703 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -10,16 +10,16 @@ - 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 - ansible.builtin.systemd: + ansible.builtin.systemd_service: name: gitea state: started enabled: 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..97007a4 100644 --- a/tasks/install_systemd.yml +++ b/tasks/install_systemd.yml @@ -2,16 +2,16 @@ - 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 - ansible.builtin.systemd: + ansible.builtin.systemd_service: daemon_reload: true diff --git a/tasks/main.yml b/tasks/main.yml index d5cb664..4efed83 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: @@ -10,16 +10,18 @@ - 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: "{{ lookup('ansible.builtin.first_found', params) }}" + ansible.builtin.include_vars: + file: "{{ lookup('ansible.builtin.first_found', params) }}" vars: params: files: 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 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'