From dba4c60d7aa25270597dbab00804fb2b5e77f797 Mon Sep 17 00:00:00 2001 From: L3D Date: Thu, 25 Jan 2024 00:02:38 +0100 Subject: [PATCH] Create systemd unit for all systems --- README.md | 2 +- tasks/install_systemd.yml | 16 +--------------- vars/debian.yml | 2 ++ vars/main.yml | 3 ++- vars/os_fallback_defaults.yml | 7 +++++++ vars/redhat.yml | 2 ++ vars/suse.yml | 2 ++ 7 files changed, 17 insertions(+), 17 deletions(-) create mode 100644 vars/os_fallback_defaults.yml diff --git a/README.md b/README.md index aee909f..1732317 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Ansible Galaxy](https://ansible.l3d.space/svg/l3d.gitea.svg)](https://galaxy.ansible.com/ui/standalone/roles/l3d/gitea/) +[![Ansible Galaxy](https://ansible.l3d.space/svg/l3d.gitea.svg)](https://galaxy.ansible.com/ui/standalone/roles/roles-ansible/gitea/) [![BSD-3 Clause](https://ansible.l3d.space/svg/l3d.gitea_license.svg)](LICENSE) [![Maintainance](https://ansible.l3d.space/svg/l3d.gitea_maintainance.svg)](https://ansible.l3d.space/#l3d.gitea) diff --git a/tasks/install_systemd.yml b/tasks/install_systemd.yml index 1d0084a..6a441cb 100644 --- a/tasks/install_systemd.yml +++ b/tasks/install_systemd.yml @@ -1,23 +1,9 @@ --- - name: "Setup systemd service" become: true - when: ansible_os_family == "Debian" ansible.builtin.template: src: gitea.service.j2 - dest: /lib/systemd/system/gitea.service - owner: root - group: root - mode: 0644 - notify: - - "Reload systemd" - - "Restart gitea" - -- name: "Setup systemd service" - become: true - when: ansible_os_family == "Suse" - ansible.builtin.template: - src: gitea.service.j2 - dest: /etc/systemd/system/gitea.service + dest: "{{ gitea_systemd_path }}/gitea.service" owner: root group: root mode: 0644 diff --git a/vars/debian.yml b/vars/debian.yml index dc164f6..784471f 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -3,3 +3,5 @@ gitea_dependencies: - git - gnupg2 - xz-utils + +gitea_systemd_path: '/lib/systemd/system' diff --git a/vars/main.yml b/vars/main.yml index 34d8ea4..cb466f6 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -23,6 +23,7 @@ gitea_variables: - "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml" - "{{ ansible_distribution | lower }}.yml" - "{{ ansible_os_family | lower }}.yml" + - 'os_fallback_defaults.yml' paths: - 'vars' @@ -62,5 +63,5 @@ transfer_custom_footer: - 'files/gitea_footer/extra_links_footer.tmpl' - 'files/extra_links_footer.tmpl' -playbook_version_number: 55 +playbook_version_number: 56 playbook_version_path: 'do1jlr.gitea.version' diff --git a/vars/os_fallback_defaults.yml b/vars/os_fallback_defaults.yml new file mode 100644 index 0000000..784471f --- /dev/null +++ b/vars/os_fallback_defaults.yml @@ -0,0 +1,7 @@ +--- +gitea_dependencies: + - git + - gnupg2 + - xz-utils + +gitea_systemd_path: '/lib/systemd/system' diff --git a/vars/redhat.yml b/vars/redhat.yml index 7c96415..393ab8d 100644 --- a/vars/redhat.yml +++ b/vars/redhat.yml @@ -3,3 +3,5 @@ gitea_dependencies: - git - gnupg2 - xz + +gitea_systemd_path: '/lib/systemd/system' diff --git a/vars/suse.yml b/vars/suse.yml index 027026e..157ba4d 100644 --- a/vars/suse.yml +++ b/vars/suse.yml @@ -3,3 +3,5 @@ gitea_dependencies: - git - gpg2 - xz + +gitea_systemd_path: '/etc/systemd/system'