Commit aae9ce00 authored by Pietsch, Martin's avatar Pietsch, Martin

bugfixes in HA configuration

parent 857a3b67
{% macro ha(ipversion = "ipv4" %} {% macro ha(ipversion = "ipv4") %}
{% set ha_servers = [] %} {% set ha_servers = [] %}
{%- for fctnhst in function_hosts -%} {%- for fctnhst in function_hosts -%}
{%- set nodenetwork = hostvars[fctnhst].network %} {%- set nodenetwork = hostvars[fctnhst].network %}
{%- if nodenetwork.devices is defined %} {%- if nodenetwork.devices is defined %}
{%- for ifname, ifdata in nodenetwork.devices.items() if ifdata.services is defined and ("dhcp-ha" in (ifdata.services | default([]))) %} {%- for ifname, ifdata in nodenetwork.devices.items() if ifdata.services is defined and ("dhcp-ha" in (ifdata.services | default([]))) %}
{%- set has = {"name": fctnhst} {%- set has = {"name": fctnhst} %}
{%- if ipversion == "ipv4" %} {%- if ipversion == "ipv4" %}
{%- do has.update({"url": 'http://%s:%s/' | format(ifdata.ipv4 | default("127.0.0.1"), kea_control_agent_port)} %} {%- do has.update({"url": 'http://%s:%s/' | format(ifdata.ipv4 | default("127.0.0.1"), kea_control_agent_port)}) %}
{%- else %} {%- else %}
{%- do has.update({"url": 'http://[%s]:%s/' | format(ifdata.ipv6 | default("::1"), kea_control_agent_port)} %} {%- do has.update({"url": 'http://[%s]:%s/' | format(ifdata.ipv6 | default("::1"), kea_control_agent_port)}) %}
{%- endif %} {%- endif %}
{%- if fctnhst != dhcp_primary_server or fctnhst != dhcp_secondary_server %} {%- if fctnhst != dhcp_primary_server or fctnhst != dhcp_secondary_server %}
{%- do has.update({"auto-failover": false, "role": "backup"}) %} {%- do has.update({"auto-failover": false, "role": "backup"}) %}
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
{%- do has.update({"auto-failover": true, "role": "standby"}) %} {%- do has.update({"auto-failover": true, "role": "standby"}) %}
{%- endif %} {%- endif %}
{%- endif %} {%- endif %}
{%- do ha_servers.update(has) -%} {%- do ha_servers.append(has) -%}
{%- endfor %} {%- endfor %}
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
"library": "/usr/lib/hooks/libdhcp_ha.so", "library": "/usr/lib/hooks/libdhcp_ha.so",
"parameters": { "parameters": {
"high-availability": [ { "high-availability": [ {
"this-server-name": "{{ inventory_hostname}}", "this-server-name": "{{ inventory_hostname }}",
{%- if kea_ha_mode = "loadbalancing" %} {%- if kea_ha_mode == "loadbalancing" %}
"mode": "load-balancing", "mode": "load-balancing",
{%- else -%} {%- else -%}
"mode": "hot-standby", "mode": "hot-standby",
......
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