Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Simple Deploy- and Management
package.dhcp.kea
Commits
73f3b328
Commit
73f3b328
authored
May 09, 2019
by
Pietsch, Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Kea Logger template and Kea Logger variables
parent
86037f11
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
107 additions
and
38 deletions
+107
-38
README.md
README.md
+43
-1
defaults/main.yml
defaults/main.yml
+8
-1
tasks/configure.yml
tasks/configure.yml
+18
-6
templates/kea-ctrl-agent.conf.j2
templates/kea-ctrl-agent.conf.j2
+5
-1
templates/kea-dhcp-ha.j2
templates/kea-dhcp-ha.j2
+1
-1
templates/kea-dhcp4.conf.j2
templates/kea-dhcp4.conf.j2
+3
-14
templates/kea-dhcp6.conf.j2
templates/kea-dhcp6.conf.j2
+3
-14
templates/kea-logger.j2
templates/kea-logger.j2
+26
-0
No files found.
README.md
View file @
73f3b328
...
...
@@ -22,7 +22,7 @@ Variables
*
kea_control_agent_config
*
description:
*
This option contains the configuration file for Kea's control agent.
*
default: "kea-c
on
tr
o
l-agent.conf.j2"
*
default: "kea-ctrl-agent.conf.j2"
*
kea_ha_mode
*
description:
...
...
@@ -32,6 +32,48 @@ Variables
*
choices: [none, loadbalancing, hotstandby]
*
default: none
*
kea_logger_destination
*
description:
*
This options specifies the destination for keas log messages.
*
choices: ["file", "stdout", "stderr", "syslog"]
*
default: "file"
*
kea_logger_severity:
*
description:
*
This option specifies the category of messages logged.
*
choices: ["DEBUG", "ERROR", "FATAL", "INFO", "WARN"]
*
default: "INFO"
*
kea_logger_debuglevel:
*
description:
*
When a logger's severity is set to DEBUG, this value specifies what level of debug messages should be printed.
*
It ranges from 0(least verbose) to 99 (most verbose).
*
default: "0"
*
kea_logger_directory
*
description:
*
This option specifies the path for keas log files.
*
default: "/var/log"
*
note: This option is only used if the variable
*kea_logger_destination*
is set to "file".
*
kea_logger_file_maxsize
*
description:
*
This is maximum size in bytes that a log file may reach.
*
default: 10240000 (10MB)
*
note: This option is only used if the variable
*kea_logger_destination*
is set to "file".
*
kea_logger_file_maxver
*
description:
*
This is maximum number of rotated versions that will be kept.
*
default: 1
*
note: This option is only used if the variable
*kea_logger_destination*
is set to "file".
*
kea_logger_file_flush:
*
description:
*
Flush buffers after each log message.
*
choices: [true, false]
*
default: true
*
kea_control_agent_port
*
description:
*
This option defines the communication port for the kea control agents.
...
...
defaults/main.yml
View file @
73f3b328
...
...
@@ -11,9 +11,16 @@ dhcp_db_password: ""
dhcp_db_dbname
:
"
"
kea_ctrl_configfile
:
"
/usr/local/etc/kea/keactrl.conf"
kea_logger_destination
:
"
file"
kea_logger_directory
:
"
/var/log"
kea_logger_severity
:
"
INFO"
kea_logger_file_maxsize
:
10240000
kea_logger_file_maxver
:
1
kea_logger_file_flush
:
true
kea_dhcp4_config
:
"
kea-dhcp4.conf.j2"
kea_dhcp6_config
:
"
kea-dhcp6.conf.j2"
kea_control_agent_config
:
"
kea-c
on
tr
o
l-agent.conf.j2"
kea_control_agent_config
:
"
kea-ctrl-agent.conf.j2"
kea_ha_mode
:
"
none"
kea_control_agent_port
:
8080
kea_outbound_interface
:
"
same-as-inbound"
...
...
tasks/configure.yml
View file @
73f3b328
...
...
@@ -3,22 +3,34 @@
name
:
package.dhcp
tasks_from
:
configure
-
name
:
install ISC kea DHCPv4 configuration
-
name
:
create ISC Kea Logger directory
file
:
path
:
"
{{
kea_logger_directory
}}"
state
:
directory
-
name
:
install ISC Kea DHCPv4 configuration
template
:
src
:
"
{{
kea_dhcp4_config
}}"
dest
:
"
{{
system_config_directory
}}/kea/kea-dhcp4.conf"
-
name
:
install ISC
k
ea DHCPv6 configuration
-
name
:
install ISC
K
ea DHCPv6 configuration
template
:
src
:
"
{{
kea_dhcp6_config
}}"
dest
:
"
{{
system_config_directory
}}/kea/kea-dhcp6.conf"
-
name
:
install ISC
k
ea control agent configuration
-
name
:
install ISC
K
ea control agent configuration
template
:
src
:
"
{{
kea_control_agent_config
}}"
dest
:
"
{{
system_config_directory
}}/kea/kea-control-agent.conf"
dest
:
"
{{
system_config_directory
}}/kea/kea-ctrl-agent.conf"
-
name
:
Workaround to start within a FreeBSD jail container
lineinfile
:
path
:
"
{{
system_config_directory
}}/rc.d/kea"
regexp
:
"
^#
KEYWORD:
nojail"
line
:
"
#
KEYWORD:
shutdown"
when
:
ansible_distribution == "FreeBSD"
-
name
:
start
kea
-
name
:
start
ISC Kea service
service
:
name
:
"
{{
service
}}"
state
:
started
...
...
@@ -27,7 +39,7 @@
loop_var
:
service
register
:
keastart
-
name
:
reload
kea
-
name
:
reload
ISC Kea service
service
:
name
:
"
{{
service
}}"
state
:
reloaded
...
...
templates/kea-c
on
tr
o
l-agent.conf.j2
→
templates/kea-ctrl-agent.conf.j2
View file @
73f3b328
...
...
@@ -19,5 +19,9 @@
"socket-name": "/tmp/kea-dhcp6-ctrl.sock"
}
}
}
},
{% from "kea-logger.j2" import logger with context %}
{{ logger("kea-ctrl-agent") }}
}
templates/kea-dhcp-ha.j2
View file @
73f3b328
...
...
@@ -10,7 +10,7 @@
{%- else %}
{%- do has.update({"url": 'http://[%s]:%s/' | format(ifdata.ipv6 | default("::1"), kea_control_agent_port)}) %}
{%- endif %}
{%- if fctnhst != dhcp_primary_server
or
fctnhst != dhcp_secondary_server %}
{%- if fctnhst != dhcp_primary_server
and
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"}) %}
...
...
templates/kea-dhcp4.conf.j2
View file @
73f3b328
...
...
@@ -104,18 +104,7 @@
"subnet4": {{ ipv4subnets | to_nice_json(indent=8) }}
},
"Logging":
{
"loggers": [
{
"name": "kea-dhcp4",
"output_options": [
{
"output": "/var/log/kea-dhcp4.log"
}
],
"severity": "INFO"
}
]
}
{% from "kea-logger.j2" import logger with context %}
{{ logger("kea-dhcp4") }}
}
templates/kea-dhcp6.conf.j2
View file @
73f3b328
...
...
@@ -92,18 +92,7 @@
"subnet6": {{ ipv6subnets | to_nice_json(indent=8) }}
},
"Logging":
{
"loggers": [
{
"name": "kea-dhcp6",
"output_options": [
{
"output": "/var/log/kea-dhcp6.log"
}
],
"severity": "INFO"
}
]
}
{% from "kea-logger.j2" import logger with context %}
{{ logger("kea-dhcp6") }}
}
templates/kea-logger.j2
0 → 100644
View file @
73f3b328
{% macro logger(service) %}
{% set logdata = {"name": service, "output_options": [{}], "severity": kea_logger_severity } %}
{% if kea_logger_severity == "DEBUG" -%}
{% do logdata.update({"debuglevel": kea_logger_debuglevel }) %}
{% endif %}
{% if kea_logger_destination == "file" %}
{% do logdata.output_options[0].update({"output": "%s/%s.log" | format(kea_logger_directory, service) }) %}
{% if kea_logger_file_maxsize is defined %}
{% do logdata.output_options[0].update({"maxsize": kea_logger_file_maxsize }) %}
{% endif %}
{% if kea_logger_file_maxver is defined %}
{% do logdata.output_options[0].update({"maxver": kea_logger_file_maxver }) %}
{% endif %}
{% if kea_logger_file_flush is defined %}
{% do logdata.output_options[0].update({"flush": kea_logger_file_flush }) %}
{% endif %}
{% else %}
{% do logdata.output_options[0].update({"output": kea_logger_destination }) %}
{% endif %}
"Logging":
{
"loggers": [
{{ logdata | to_nice_json(indent=8) }}
]
}
{% 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