1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_etebase.git synced 2024-08-16 10:19:52 +02:00

Setup etebase systemd

This commit is contained in:
L3D 2022-11-12 18:32:49 +01:00
parent 4f2a52effa
commit 29588c79a0
Signed by: l3d
GPG key ID: CD08445BFF4313D1
6 changed files with 53 additions and 1 deletions

View file

@ -5,6 +5,7 @@ etebase__user: 'etebase'
etebase__user_home: '/var/lib/etebase'
etebase__shell: '/bin/false'
etebase__venv: "{{ etebase__user_home }}/venv"
etebase__socket: '/tmp/etebase_server.sock'
# package state
etebase__package_state: 'present'
@ -38,5 +39,10 @@ etebase__database_options_extra: ''
etebase__ldap_extra: ''
etebase__config_extra: ''
# webosting
etebase__restart_webserver: false
etebase__webserver_service: 'nginx.service'
etebase__systemd_setup: false
# should we do a version check? (recomended)
submodules_versioncheck: false

14
handlers/main.yml Normal file
View file

@ -0,0 +1,14 @@
---
- name: "Systemctl restart etebase.service"
become: true
ansible.builtin.service:
name: etebase.service
state: restarted
when: ansible_service_mgr == "systemd"
- name: "Systemctl restart webserver"
become: true
ansible.builtin.systemd:
name: "{{ etebase__webserver_service }}"
state: restarted
when: ansible_service_mgr == "systemd" and etebase__restart_webserver | bool

View file

@ -20,3 +20,7 @@
- name: Run ./manage.py migrate
ansible.builtin.include_tasks: migrate.yml
- name: Setup Systemd Service
ansible.builtin.include_tasks: systemd.yml
when: etebase__systemd_setup | bool

17
tasks/systemd.yml Normal file
View file

@ -0,0 +1,17 @@
---
- name: "Setup systemd service"
become: true
ansible.builtin.template:
src: 'templates/etebase.service.j2'
dest: /lib/systemd/system/etebase.service
owner: root
group: root
mode: 0644
notify:
- "Systemctl restart etebase.service"
- "Systemctl restart webserver"
- name: "Reload systemd"
become: true
ansible.builtin.systemd:
daemon_reload: true

View file

@ -0,0 +1,11 @@
# {{ ansible_managed }}
[Unit]
Description=Execute the etebase server.
[Service]
WorkingDirectory={{ etebase__user_home }}/etebase_{{ etebase_version_target }}
ExecStart={{ etebase__venv }}/bin/uvicorn etebase_server.asgi:application --uds {{ etebase__socket }}
[Install]
WantedBy=multi-user.target

View file

@ -3,5 +3,5 @@ etebase__repo: 'https://github.com/etesync/server.git'
etebase__repo_api: 'https://api.github.com/repos/etesync/server/tags'
# versionscheck
playbook_version_number: 6 # should be a integer
playbook_version_number: 7 # should be a integer
playbook_version_path: 'role-etebase'