diff --git a/templates/fastd.conf.j2 b/templates/fastd.conf.j2 index 9d7a3e5..0df4306 100644 --- a/templates/fastd.conf.j2 +++ b/templates/fastd.conf.j2 @@ -1,6 +1,8 @@ -secret "{{ profile.value.private_key }}"; +# ansible managed + +secret "{{ profile.value.private_key |mandatory('A profile required a private_key') }}"; log level {{ profile.value.log_level |d("info") }}; -interface "{{ profile.value.interface |d('fastd-%s' |format(profile.key)) }}"; +interface "{{ profile.value.interface |d('fastd_%s' |format(profile.key)) }}"; mode {{ profile.value.mode |d("tap") }}; mtu {{ profile.value.mtu |d("1280") }}; @@ -8,12 +10,13 @@ mtu {{ profile.value.mtu |d("1280") }}; method "{{ method }}"; {% endfor %} -bind {{ profile.value.bind |d('any:10061') }}; - -{% if not (profile.value.verify |d(True)) %} -on verify "true"; +{% if profile.value.bind |d(False) %} +bind {{ profile.value.bind }}; {% endif %} -include peers from "peers"; +include peers from "{{ config_dir }}/{{ profile.key }}/peers"; +{% if profile.value.additional_config |d(False) %} +{{ profile.value.additional_config }} +{% endif %} diff --git a/templates/peer.j2 b/templates/peer.j2 index 56b0ca5..759b9e6 100644 --- a/templates/peer.j2 +++ b/templates/peer.j2 @@ -1,4 +1,6 @@ -key "{{ peer.value.public_key }}"; +# ansible managed + +key "{{ peer.value.public_key |mandatory('A public key is required for a peer') }}"; {% for remote in peer.value.remotes |d([]) %} remote {{ remote }};