#jinja2:lstrip_blocks: True {{ ansible_managed | comment }} [Unit] Description=Lego renew Requires=network-online.target After=network-online.target [Service] Type=oneshot EnvironmentFile=/etc/sysconfig/lego {% for cert in lego_certificates %} ExecStart={{ __lego_bin_file }} --email="{{ lego_acme_account_email }}" --domains {{ ' --domains '.join(cert.domains) }} $ARGS renew {{ '--renew-hook="' + __lego_base_dir + '/hooks/' + cert.name + '.sh"' if cert.hook is defined else '' }} --days 30 {% endfor %} [Install] WantedBy=multi-user.target