Commit 14364c01 authored by Pietsch, Martin's avatar Pietsch, Martin

transform backend template to macro

parent dac8b4dd
{% if dhcp_backend == "memfile" %}
{% macro backends(ipversion="ipv4") %}
{% if dhcp_backend == "memfile" %}
"lease-database": {
"type": "memfile",
{% if ipversion == "ipv4" %}
"name": "/var/db/kea/kea-leases4"
{% else %}
"name": "/var/db/kea/kea-leases6"
{% endif %}
},
{% elif dhcp_backend == "cassandra" %}
{% elif dhcp_backend == "cassandra" %}
"lease-database": {
"type": "cql",
"keyspace": "{{ dhcp_db_dbname }}"
"contact-points": "{{ dhcp_db_host }}"
{% if dhcp_db_port is defined %}
{% if dhcp_db_port is defined %}
"port": "{{ dhcp_db_port }}"
{% endif %}
{% endif %}
},
{% else %}
{% else %}
"lease-database": {
"type": "{{ dhcp_backend }}",
"name": "{{ dhcp_db_dbname }}",
"host": "{{ dhcp_db_host }}",
{% if dhcp_db_port is defined %}
{% if dhcp_db_port is defined %}
"port": "{{ dhcp_db_port }}"
{% endif %}
{% endif %}
"user": "{{ dhcp_db_user }}"
"password": "{{ dhcp_db_password | default("") }}"
},
......@@ -28,10 +33,11 @@
"type": "{{ dhcp_backend }}",
"name": "{{ dhcp_db_dbname }}",
"host": "{{ dhcp_db_host }}",
{% if dhcp_db_port is defined %}
{% if dhcp_db_port is defined %}
"port": "{{ dhcp_db_port }}"
{% endif %}
{% endif %}
"user": "{{ dhcp_db_user }}"
"password": "{{ dhcp_db_password | default("") }}"
},
{% endif %}
{% endif %}
{% endmacro %}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment