mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-07-27 00:05:44 +02:00
Update to 2022-03-04 18:00
This commit is contained in:
20
roles/sftpgo/templates/dehydrated_hook.j2
Normal file
20
roles/sftpgo/templates/dehydrated_hook.j2
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
SFTPGO_RELOAD=0
|
||||
{% for service in ['ftpd','webdavd','httpd','telemetry'] %}
|
||||
{% if sftpgo_conf[service].certificate_file is defined and sftpgo_conf[service].certificate_file is search('^letsencrypt:') %}
|
||||
{% set certificate_name = sftpgo_conf[service].certificate_file | regex_replace('^letsencrypt:', '') %}
|
||||
if [ $1 == "{{ certificate_name }}" ]; then
|
||||
SFTPGO_RELOAD=1
|
||||
cp /var/lib/dehydrated/certificates/certs/{{ certificate_name }}/fullchain.pem {{ sftpgo_root_dir }}/etc/ssl/{{ service }}.crt
|
||||
cp /var/lib/dehydrated/certificates/certs/{{ certificate_name }}/privkey.pem {{ sftpgo_root_dir }}/etc/ssl/{{ service }}.key
|
||||
chown root:{{ sftpgo_user }} {{ sftpgo_root_dir }}/etc/ssl/{{ service }}.{crt,key}
|
||||
chmod 644 {{ sftpgo_root_dir }}/etc/ssl/{{ service }}.crt
|
||||
chmod 640 {{ sftpgo_root_dir }}/etc/ssl/{{ service }}.key
|
||||
fi
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
if [ "$SFTPGO_RELOAD" == "1" ]; then
|
||||
systemctl reload sftpgo.service
|
||||
fi
|
@@ -2,6 +2,9 @@
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
{% if sftpgo_db_engine == 'sqlite' %}
|
||||
sqlite3 {{ sftpgo_root_dir }}/data/sftpgo.sqlite .dump | zstd -c > {{ sftpgo_root_dir }}/backup/sftpgo.sql.zst
|
||||
{% elif sftpgo_db_engine == 'mysql' %}
|
||||
/usr/bin/mysqldump \
|
||||
{% if sftpgo_db_server not in ['localhost', '127.0.0.1'] %}
|
||||
--user={{ sftpgo_db_user | quote }} \
|
||||
@@ -12,5 +15,6 @@ set -eo pipefail
|
||||
--quick --single-transaction \
|
||||
--add-drop-table {{ sftpgo_db_name }} | \
|
||||
zstd -c > {{ sftpgo_root_dir }}/backup/{{ sftpgo_db_name }}.sql.zst
|
||||
{% endif %}
|
||||
|
||||
cp -a {{ sftpgo_root_dir }}/etc/id_* {{ sftpgo_root_dir }}/backup/
|
||||
|
Reference in New Issue
Block a user