Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
package.dhcp.kea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Simple Deploy- and Management
package.dhcp.kea
Commits
f9d93d7d
Commit
f9d93d7d
authored
Apr 25, 2019
by
Pietsch, Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ha definitions
parent
ee5bbaeb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
+57
-0
templates/kea-dhcp-ha.j2
templates/kea-dhcp-ha.j2
+57
-0
No files found.
templates/kea-dhcp-ha.j2
0 → 100644
View file @
f9d93d7d
{% macro ha(ipversion = "ipv4" %}
{% set ha_servers = [] %}
{%- for fctnhst in function_hosts -%}
{%- set nodenetwork = hostvars[fctnhst].network %}
{%- if nodenetwork.devices is defined %}
{%- for ifname, ifdata in nodenetwork.devices.items() if ifdata.services is defined and ("dhcp-ha" in (ifdata.services | default([]))) %}
{%- set has = {"name": fctnhst}
{%- if ipversion == "ipv4" %}
{%- do has.update({"url": 'http://%s:%s/' | format(ifdata.ipv4 | default("127.0.0.1"), kea_ha_port)} %}
{%- else %}
{%- do has.update({"url": 'http://[%s]:%s/' | format(ifdata.ipv6 | default("::1"), kea_ha_port)} %}
{%- endif %}
{%- if fctnhst != dhcp_primary_server or fctnhst != dhcp_secondary_server %}
{%- do has.update({"auto-failover": false, "role": "backup"}) %}
{%- elif fctnhst == dhcp_primary_server %}
{%- do has.update({"auto-failover": true, "role": "primary"}) %}
{%- else %}
{%- if kea_ha_mode == "loadbalancing" %}
{%- do has.update({"auto-failover": true, "role": "secondary"}) %}
{%- else %}
{%- do has.update({"auto-failover": true, "role": "standby"}) %}
{%- endif %}
{%- endif %}
{%- do ha_servers.update(has) -%}
{%- endfor %}
{%- endif %}
{%- endfor %}
{%- if (ha_servers | length) > 0 -%}
"hooks-libraries": [
{
"library": "/usr/lib/hooks/libdhcp_lease_cmds.so",
"parameters": { }
},
{
"library": "/usr/lib/hooks/libdhcp_ha.so",
"parameters": {
"high-availability": [ {
"this-server-name": "{{ inventory_hostname}}",
{%- if kea_ha_mode = "loadbalancing" %}
"mode": "load-balancing",
{%- else -%}
"mode": "hot-standby",
{%- endif -%}
"heartbeat-delay": 10000,
"max-response-delay": 10000,
"max-ack-delay": 5000,
"max-unacked-clients": 5,
"peers": [
{{ ha_servers | to_nice_json(indent=8) }}
]
}
]
}
]
{%- endif -%}
{%- endmacro %}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment