# managed by Ansible
{% import 'macros.j2' as macros with context %}

authority {{ acme__authority_name }} {
	api url "{{ acme__authority_url }}"
	account key "{{ acme__authority_key }}"
}

{% call(h) macros.loop_valid_hosts(relayd__connected_hosts) -%}
{% for rule in h.acme__rules %}

domain {{ rule.domain }} {
	# alternative names { www.{{ rule.domain }} }
	domain key "{{ acme__keys_dir }}/{{ rule.domain }}.key"
	domain full chain certificate "{{ acme__certificates_dir }}/{{ rule.domain }}.crt"
	sign with {{ acme__authority_name }}
}
{% endfor %}
{%- endcall %}