diff --git a/roles/sftpgo/tasks/conf.yml b/roles/sftpgo/tasks/conf.yml index 895bd75..8605c11 100644 --- a/roles/sftpgo/tasks/conf.yml +++ b/roles/sftpgo/tasks/conf.yml @@ -6,15 +6,15 @@ # We do so by configuring certificate_file: letsencrypt:foo.example.org in SFTPGo configuration - name: Handle Let's Encrypt cert set_fact: - sftpgo_conf: "{{ sftpgo_conf | combine({ item: {'certificate_file': sftpgo_root_dir ~ '/etc/ssl/' ~ item ~ '.crt', 'certificate_key_file': sftpgo_root_dir ~ '/etc/ssl/' ~ item ~ '.key'}}, recursive=True) }}" + sftpgo_conf: "{{ sftpgo_conf | combine({ item: {'bindings': {'certificate_file': sftpgo_root_dir ~ '/etc/ssl/' ~ item ~ '.crt', 'certificate_key_file': sftpgo_root_dir ~ '/etc/ssl/' ~ item ~ '.key'} } }, recursive=True) }}" loop: - ftpd - webdavd - httpd - telemetry when: - - sftpgo_conf[item].certificate_file is defined - - sftpgo_conf[item].certificate_file is search('^letsencrypt:') + - sftpgo_conf[item].bindings.certificate_file is defined + - sftpgo_conf[item].bindings.certificate_file is search('^letsencrypt:') tags: sftpgo - name: Deploy sftpgo config diff --git a/roles/sftpgo/templates/dehydrated_hook.j2 b/roles/sftpgo/templates/dehydrated_hook.j2 index 9ecf4e6..7ace6f7 100644 --- a/roles/sftpgo/templates/dehydrated_hook.j2 +++ b/roles/sftpgo/templates/dehydrated_hook.j2 @@ -2,8 +2,8 @@ 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 sftpgo_conf[service].bindings.certificate_file is defined and sftpgo_conf[service].bindings.certificate_file is search('^letsencrypt:') %} +{% set certificate_name = sftpgo_conf[service].bindings.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