[Unit]
Description=MariaDB database server
After=network.target
Watns=network.target

[Service]
Type=simple
NoNewPrivileges=true
SendSIGKILL=no
KillSignal=SIGTERM
PermissionsStartOnly=true
{% if (ansible_become == true and ansible_become_user == 'root') or ansible_user == 'root' %}
ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION"
ExecStartPost=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION"
{% endif %}
ReadWritePaths={{conda_path }}
ExecStart={{ bash_cmd }} -c "{{ conda_path }}/bin/start-freva-service -s mysql"
Environment="PATH={{conda_path}}/bin:{{ ansible_env.PATH }}"
StandardOutput=journal
StandardError=journal
Restart=on-failure
RestartSec=5
StartLimitBurst=5
EnvironmentFile={{ data_dir }}/config/service.env
{% if (ansible_become == true and ansible_become_user == 'root') or ansible_user == 'root' %}
ProtectHome=true
ProtectSystem=full
User={{uid}}
Group={{gid}}
{% endif %}

[Install]
WantedBy=multi-user.target
