From df387f02454f5b7f2a565211afae3b509ec0d67c Mon Sep 17 00:00:00 2001 From: Eliot Berriot <contact@eliotberriot.com> Date: Tue, 7 Jan 2020 11:43:42 +0100 Subject: [PATCH] Make systemd configuration optional --- README.md | 1 + defaults/main.yml | 1 + handlers/main.yml | 1 + tasks/services.yml | 3 +++ 4 files changed, 6 insertions(+) diff --git a/README.md b/README.md index ab269db..5eef47b 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,7 @@ Role Variables | `funkwhale_ssl_cert_path` | `` | Path to an existing SSL certificate to use (use in combination with `funkwhale_letsencrypt_enabled: false`) | | `funkwhale_ssl_key_path` | `` | Path to an existing SSL key to use (use in combination with `funkwhale_letsencrypt_enabled: false`) | | `funkwhale_static_path` | `/srv/funkwhale/data/static` | Path were Funkwhale static files should be stored | +| `funkwhale_systemd_managed` | `true` | If `true`, will configure Funkwhale systemd services | | `funkwhale_systemd_after` | `redis.service postgresql.service` | Configuration used for Systemd `After=` directive. Modify it if you have a database or redis server on a separate host | | `funkwhale_systemd_service_name` | `funkwhale` | Name of the generated Systemd service, e.g when calling `systemctl start <xxx>` | | `funkwhale_username` | `funkwhale` | Username of the system user and owner of Funkwhale data, files and configuration | diff --git a/defaults/main.yml b/defaults/main.yml index a07a6f4..d46d710 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -21,6 +21,7 @@ funkwhale_web_workers: 1 funkwhale_protocol: https funkwhale_settings_module: config.settings.production funkwhale_env_vars: [] +funkwhale_systemd_managed: true funkwhale_systemd_after: redis.service postgresql.service funkwhale_systemd_service_name: funkwhale funkwhale_letsencrypt_certbot_flags: diff --git a/handlers/main.yml b/handlers/main.yml index f4b7666..5e3952e 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -7,6 +7,7 @@ - name: reload funkwhale become: true + when: funkwhale_systemd_managed shell: | systemctl kill -s HUP {{ funkwhale_systemd_service_name }}-server systemctl kill -s HUP {{ funkwhale_systemd_service_name }}-worker diff --git a/tasks/services.yml b/tasks/services.yml index f682f7d..d07b6f6 100644 --- a/tasks/services.yml +++ b/tasks/services.yml @@ -2,6 +2,7 @@ - name: "Create {{ funkwhale_systemd_service_name }}-* systemd file" become: true + when: funkwhale_systemd_managed template: src: "funkwhale-process.service.j2" dest: "/etc/systemd/system/{{ funkwhale_systemd_service_name }}-{{ item.name }}.service" @@ -21,6 +22,7 @@ - name: "Create {{ funkwhale_systemd_service_name }} systemd target file" become: true + when: funkwhale_systemd_managed template: src: "{{ funkwhale_systemd_service_name }}.target.j2" dest: "/etc/systemd/system/{{ funkwhale_systemd_service_name }}.target" @@ -30,6 +32,7 @@ - name: "Start and enable {{ funkwhale_systemd_service_name }}-* services" become: true + when: funkwhale_systemd_managed systemd: name: "{{ item }}" enabled: true -- GitLab