kea_dhcp(role): update to newest fux noc version
This commit is contained in:
parent
6006dbca27
commit
8d9cb0007c
14 changed files with 322 additions and 231 deletions
|
|
@ -1,6 +1,10 @@
|
||||||
kea_dhcp__stork_agent:
|
---
|
||||||
enable: false
|
# Set Kea group name based on distribution
|
||||||
prometheus_only: true
|
kea_dhcp__service_group: "{{ '_kea' if ansible_facts['distribution'] == 'Debian' else 'kea' }}"
|
||||||
|
kea_dhcp__unit_base_name: "{{ 'isc-kea' if ansible_facts['distribution'] == 'Debian' else 'kea' }}"
|
||||||
|
kea_dhcp__unit_base_sufix: "{{ '-server' if ansible_facts['distribution'] == 'Debian' else '' }}"
|
||||||
|
|
||||||
|
kea_dhcp__version_repo: "kea-3-0"
|
||||||
kea_dhcp__dns_servers:
|
kea_dhcp__dns_servers:
|
||||||
v6:
|
v6:
|
||||||
- "2a07:c481:0:4::2"
|
- "2a07:c481:0:4::2"
|
||||||
|
|
@ -8,61 +12,75 @@ kea_dhcp__dns_servers:
|
||||||
v4:
|
v4:
|
||||||
- "185.161.128.66"
|
- "185.161.128.66"
|
||||||
- "185.161.128.67"
|
- "185.161.128.67"
|
||||||
kea_dhcp__include_vars:
|
kea_dhcp__ntp_servers:
|
||||||
|
v4:
|
||||||
|
- "185.161.128.7"
|
||||||
|
- "185.161.128.8"
|
||||||
|
v6: "2a07:c481:0:3::7"
|
||||||
|
fqdn: ntp.z9.fux-eg.net
|
||||||
|
kea_dhcp__sntp_servers:
|
||||||
|
v6:
|
||||||
|
- "2a07:c481:0:3::7"
|
||||||
|
- "2a07:c481:0:3::8"
|
||||||
|
|
||||||
kea_dhcp__dhcp4:
|
kea_dhcp__stork_agent_defaults:
|
||||||
|
enable: false
|
||||||
|
prometheus_only: true
|
||||||
|
kea_dhcp__stork_agent: {}
|
||||||
|
|
||||||
|
kea_dhcp__dhcp4_defaults:
|
||||||
enable: false
|
enable: false
|
||||||
interfaces: [ ]
|
interfaces: [ ]
|
||||||
control-sockets:
|
control-sockets:
|
||||||
- socket-name: /var/run/kea-dhcp4-ctrl-agent.sock
|
- socket-name: /var/run/kea/dhcp4-ctrl-agent.sock
|
||||||
socket-type: unix
|
socket-type: unix
|
||||||
lease-database:
|
lease-database:
|
||||||
type: memfile
|
type: memfile
|
||||||
persist: true
|
persist: true
|
||||||
option-data:
|
option-data:
|
||||||
- name: "domain-name-servers"
|
- name: domain-name-servers
|
||||||
code: 6
|
code: 6
|
||||||
csv-format: true
|
csv-format: true
|
||||||
data: "{{ kea_dhcp__dns_servers.v4 | join(',') }}"
|
data: "{{ kea_dhcp__dns_servers.v4 | join(',') }}"
|
||||||
subnets:
|
- name: ntp-servers
|
||||||
- id: 0
|
code: 42
|
||||||
subnet: nil
|
data: "{{ kea_dhcp__ntp_servers.v4 | join(',') }}"
|
||||||
pools:
|
logging:
|
||||||
- pool: nil
|
- name: kea-dhcp4
|
||||||
reservations:
|
output-options:
|
||||||
- ip-address: nil
|
- output: stdout
|
||||||
hostname: beispiel.test
|
severity: INFO
|
||||||
hw-address: "00:11:22:33:44:55"
|
kea_dhcp__dhcp4: {}
|
||||||
option-data:
|
|
||||||
- name: nil,
|
kea_dhcp__dhcp6_defaults:
|
||||||
code: nil,
|
|
||||||
csv-format: true
|
|
||||||
data: nil
|
|
||||||
kea_dhcp__dhcp6:
|
|
||||||
enable: false
|
enable: false
|
||||||
interfaces: [ ]
|
interfaces: [ ]
|
||||||
|
control-sockets:
|
||||||
|
- socket-name: /var/run/kea/dhcp6-ctrl-agent.sock
|
||||||
|
socket-type: unix
|
||||||
lease-database:
|
lease-database:
|
||||||
type: memfile
|
type: memfile
|
||||||
persist: true
|
persist: true
|
||||||
control-sockets:
|
|
||||||
- socket-name: /var/run/kea-dhcp6-ctrl-agent.sock
|
|
||||||
socket-type: unix
|
|
||||||
option-data:
|
option-data:
|
||||||
- name: "dns-servers"
|
- name: dns-servers
|
||||||
code: 23
|
code: 23
|
||||||
csv-format: true
|
|
||||||
data: "{{ kea_dhcp__dns_servers.v6 | join(',') }}"
|
data: "{{ kea_dhcp__dns_servers.v6 | join(',') }}"
|
||||||
subnets:
|
- name: sntp-servers
|
||||||
- id: 0
|
code: 31
|
||||||
subnet: nil
|
data: "{{ kea_dhcp__sntp_servers.v6 | join(',') }}"
|
||||||
pools:
|
- name: ntp-server
|
||||||
- pool: nil
|
code: 56
|
||||||
reservations:
|
- name: ntp-server-address
|
||||||
- ip-address: nil
|
space: v6-ntp-server-suboptions
|
||||||
hostname: beispiel.test
|
data: "{{ kea_dhcp__ntp_servers.v6 }}"
|
||||||
hw-address: "00:11:22:33:44:55"
|
- name: ntp-server-fqdn
|
||||||
option-data:
|
space: v6-ntp-server-suboptions
|
||||||
- name: nil,
|
data: "{{ kea_dhcp__ntp_servers.fqdn }}"
|
||||||
code: nil,
|
logging:
|
||||||
csv-format: true
|
- name: kea-dhcp6
|
||||||
data: nil
|
output-options:
|
||||||
|
- output: stdout
|
||||||
|
severity: INFO
|
||||||
|
kea_dhcp__dhcp6: {}
|
||||||
|
|
||||||
|
kea_dhcp__include_vars:
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,40 @@
|
||||||
---
|
---
|
||||||
- name: Systemd.daemon_reload
|
- name: Systemd_daemon_reload
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.systemd_service:
|
ansible.builtin.systemd_service:
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
|
|
||||||
- name: Kea_dhcp4.restarted
|
- name: Kea_dhcp4.restarted_debian
|
||||||
ansible.builtin.service:
|
listen: Kea_dhcp4.restarted
|
||||||
name: kea-dhcp4
|
|
||||||
state: restarted
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
- name: Kea_dhcp6.restarted
|
|
||||||
ansible.builtin.service:
|
|
||||||
name: kea-dhcp6
|
|
||||||
state: restarted
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
- name: Kea_ctrl.restarted
|
|
||||||
ansible.builtin.systemd:
|
|
||||||
name: kea-ctrl-agent
|
|
||||||
state: restarted
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
- name: Stork_agent.restarted
|
|
||||||
become: true
|
become: true
|
||||||
|
when: ansible_facts['distribution'] == 'Debian'
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: isc-kea-dhcp4-server
|
||||||
|
state: restarted
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
- name: Kea_dhcp6.restarted_debian
|
||||||
|
listen: Kea_dhcp6.restarted
|
||||||
|
become: true
|
||||||
|
when: ansible_facts['distribution'] == 'Debian'
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: isc-kea-dhcp6-server
|
||||||
|
state: restarted
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
- name: Kea_ctrl.restarted_debian
|
||||||
|
listen: Kea_ctrl.restarted
|
||||||
|
become: true
|
||||||
|
when: ansible_facts['distribution'] == 'Debian'
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: isc-kea-ctrl-agent
|
||||||
|
state: restarted
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
- name: Stork_agent.restarted_debian
|
||||||
|
listen: Stork_agent.restarted
|
||||||
|
become: true
|
||||||
|
when: ansible_facts['distribution'] == 'Debian'
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: isc-stork-agent
|
name: isc-stork-agent
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,11 @@ argument_specs:
|
||||||
main:
|
main:
|
||||||
short_description: "Role for managing Kea DHCP server"
|
short_description: "Role for managing Kea DHCP server"
|
||||||
options:
|
options:
|
||||||
kea_dhcp__stork_agent:
|
kea_dhcp__stork_agent_defaults:
|
||||||
type: "dict"
|
type: "dict"
|
||||||
description: "Configuration for Stork Agent"
|
description:
|
||||||
|
- "Default configuration for Stork Agent."
|
||||||
|
- "Merged with kea_dhcp__stork_agent using combine(recursive=True)."
|
||||||
options:
|
options:
|
||||||
enable:
|
enable:
|
||||||
type: "bool"
|
type: "bool"
|
||||||
|
|
@ -13,10 +15,39 @@ argument_specs:
|
||||||
prometheus_only:
|
prometheus_only:
|
||||||
type: "bool"
|
type: "bool"
|
||||||
default: true
|
default: true
|
||||||
|
kea_dhcp__stork_agent:
|
||||||
|
type: "dict"
|
||||||
|
description:
|
||||||
|
- "Host/group override for Stork Agent configuration."
|
||||||
|
- "Merged on top of kea_dhcp__stork_agent_defaults using combine(recursive=True)."
|
||||||
|
- "Only specify the keys you want to override."
|
||||||
kea_dhcp__version_repo:
|
kea_dhcp__version_repo:
|
||||||
type: "str"
|
type: "str"
|
||||||
description: "Version of Kea DHCP repository to use"
|
description:
|
||||||
|
- "Version of Kea DHCP repository to use."
|
||||||
|
- "The versions can be found at https://cloudsmith.io/~isc/repos/"
|
||||||
default: "kea-3-0"
|
default: "kea-3-0"
|
||||||
|
kea_dhcp__ntp_servers:
|
||||||
|
type: "dict"
|
||||||
|
description: "Default NTP servers advertised to DHCP clients (DHCPv4 option 42, DHCPv6 option 56)."
|
||||||
|
options:
|
||||||
|
v4:
|
||||||
|
type: "list"
|
||||||
|
elements: "str"
|
||||||
|
v6:
|
||||||
|
type: "str"
|
||||||
|
fqdn:
|
||||||
|
type: "str"
|
||||||
|
kea_dhcp__sntp_servers:
|
||||||
|
type: "dict"
|
||||||
|
description: "Default SNTP servers advertised to DHCPv6 clients (option 31)."
|
||||||
|
options:
|
||||||
|
v4:
|
||||||
|
type: "list"
|
||||||
|
elements: "str"
|
||||||
|
v6:
|
||||||
|
type: "list"
|
||||||
|
elements: "str"
|
||||||
kea_dhcp__dns_servers:
|
kea_dhcp__dns_servers:
|
||||||
type: "dict"
|
type: "dict"
|
||||||
description: "Default DNS servers for DHCP clients"
|
description: "Default DNS servers for DHCP clients"
|
||||||
|
|
@ -27,9 +58,11 @@ argument_specs:
|
||||||
v4:
|
v4:
|
||||||
type: "list"
|
type: "list"
|
||||||
elements: "str"
|
elements: "str"
|
||||||
kea_dhcp__dhcp4:
|
kea_dhcp__dhcp4_defaults:
|
||||||
type: "dict"
|
type: "dict"
|
||||||
description: "Configuration for DHCPv4 service"
|
description:
|
||||||
|
- "Default configuration for DHCPv4 service."
|
||||||
|
- "Merged with kea_dhcp__dhcp4 using combine(recursive=True)."
|
||||||
options:
|
options:
|
||||||
enable:
|
enable:
|
||||||
type: "bool"
|
type: "bool"
|
||||||
|
|
@ -37,89 +70,65 @@ argument_specs:
|
||||||
interfaces:
|
interfaces:
|
||||||
type: "list"
|
type: "list"
|
||||||
elements: "str"
|
elements: "str"
|
||||||
default: [ ]
|
default: []
|
||||||
control-sockets:
|
control-sockets:
|
||||||
type: "list"
|
type: "list"
|
||||||
elements: "dict"
|
elements: "dict"
|
||||||
lease-database:
|
lease-database:
|
||||||
type: "dict"
|
type: "dict"
|
||||||
|
hooks-libraries:
|
||||||
|
type: "list"
|
||||||
|
elements: "dict"
|
||||||
option-data:
|
option-data:
|
||||||
type: "list"
|
type: "list"
|
||||||
elements: "dict"
|
elements: "dict"
|
||||||
subnets:
|
subnets:
|
||||||
type: "list"
|
type: "list"
|
||||||
elements: "dict"
|
elements: "dict"
|
||||||
options:
|
logging:
|
||||||
id:
|
|
||||||
type: "int"
|
|
||||||
subnet:
|
|
||||||
type: "str"
|
|
||||||
pools:
|
|
||||||
type: "list"
|
type: "list"
|
||||||
elements: "dict"
|
elements: "dict"
|
||||||
|
kea_dhcp__dhcp4:
|
||||||
|
type: "dict"
|
||||||
|
description:
|
||||||
|
- "Host/group override for DHCPv4 configuration."
|
||||||
|
- "Merged on top of kea_dhcp__dhcp4_defaults using combine(recursive=True)."
|
||||||
|
- "Only specify the keys you want to override."
|
||||||
|
- "See kea_dhcp__dhcp4_defaults for available options."
|
||||||
|
kea_dhcp__dhcp6_defaults:
|
||||||
|
type: "dict"
|
||||||
|
description:
|
||||||
|
- "Default configuration for DHCPv6 service."
|
||||||
|
- "Merged with kea_dhcp__dhcp6 using combine(recursive=True)."
|
||||||
options:
|
options:
|
||||||
pool:
|
enable:
|
||||||
type: "str"
|
type: "bool"
|
||||||
reservations:
|
default: false
|
||||||
|
interfaces:
|
||||||
|
type: "list"
|
||||||
|
elements: "str"
|
||||||
|
default: []
|
||||||
|
control-sockets:
|
||||||
|
type: "list"
|
||||||
|
elements: "dict"
|
||||||
|
lease-database:
|
||||||
|
type: "dict"
|
||||||
|
hooks-libraries:
|
||||||
type: "list"
|
type: "list"
|
||||||
elements: "dict"
|
elements: "dict"
|
||||||
options:
|
|
||||||
ip-address:
|
|
||||||
type: "str"
|
|
||||||
hostname:
|
|
||||||
type: "str"
|
|
||||||
hw-address:
|
|
||||||
type: "str"
|
|
||||||
duid:
|
|
||||||
type: "str"
|
|
||||||
option-data:
|
option-data:
|
||||||
type: "list"
|
type: "list"
|
||||||
elements: "dict"
|
elements: "dict"
|
||||||
|
subnets:
|
||||||
|
type: "list"
|
||||||
|
elements: "dict"
|
||||||
|
logging:
|
||||||
|
type: "list"
|
||||||
|
elements: "dict"
|
||||||
kea_dhcp__dhcp6:
|
kea_dhcp__dhcp6:
|
||||||
type: "dict"
|
type: "dict"
|
||||||
description: "Configuration for DHCPv6 service"
|
description:
|
||||||
options:
|
- "Host/group override for DHCPv6 configuration."
|
||||||
enable:
|
- "Merged on top of kea_dhcp__dhcp6_defaults using combine(recursive=True)."
|
||||||
type: "bool"
|
- "Only specify the keys you want to override."
|
||||||
default: false
|
- "See kea_dhcp__dhcp6_defaults for available options."
|
||||||
interfaces:
|
|
||||||
type: "list"
|
|
||||||
elements: "str"
|
|
||||||
default: [ ]
|
|
||||||
control-sockets:
|
|
||||||
type: "list"
|
|
||||||
elements: "dict"
|
|
||||||
lease-database:
|
|
||||||
type: "dict"
|
|
||||||
option-data:
|
|
||||||
type: "list"
|
|
||||||
elements: "dict"
|
|
||||||
subnets:
|
|
||||||
type: "list"
|
|
||||||
elements: "dict"
|
|
||||||
options:
|
|
||||||
id:
|
|
||||||
type: "int"
|
|
||||||
subnet:
|
|
||||||
type: "str"
|
|
||||||
pools:
|
|
||||||
type: "list"
|
|
||||||
elements: "dict"
|
|
||||||
options:
|
|
||||||
pool:
|
|
||||||
type: "str"
|
|
||||||
reservations:
|
|
||||||
type: "list"
|
|
||||||
elements: "dict"
|
|
||||||
options:
|
|
||||||
ip-address:
|
|
||||||
type: "str"
|
|
||||||
hostname:
|
|
||||||
type: "str"
|
|
||||||
hw-address:
|
|
||||||
type: "str"
|
|
||||||
duid:
|
|
||||||
type: "str"
|
|
||||||
option-data:
|
|
||||||
type: "list"
|
|
||||||
elements: "dict"
|
|
||||||
|
|
|
||||||
21
roles/kea_dhcp/tasks/install_debian.yaml
Normal file
21
roles/kea_dhcp/tasks/install_debian.yaml
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
---
|
||||||
|
- name: Register isc-kea apt repository
|
||||||
|
become: true
|
||||||
|
register: kea_dhcp__repo
|
||||||
|
ansible.builtin.deb822_repository:
|
||||||
|
name: "isc-{{ kea_dhcp__version_repo }}"
|
||||||
|
uris: "https://dl.cloudsmith.io/public/isc/{{ kea_dhcp__version_repo }}/deb/debian"
|
||||||
|
suites: "{{ ansible_facts['distribution_release'] }}"
|
||||||
|
components: main
|
||||||
|
signed_by: "https://dl.cloudsmith.io/public/isc/{{ kea_dhcp__version_repo }}/gpg.key"
|
||||||
|
|
||||||
|
- name: Install Kea packages
|
||||||
|
become: true
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name:
|
||||||
|
- isc-kea-dhcp4
|
||||||
|
- isc-kea-dhcp6
|
||||||
|
- isc-kea-hooks
|
||||||
|
- isc-kea-ctrl-agent
|
||||||
|
- isc-kea-admin
|
||||||
|
update_cache: "{{ kea_dhcp__repo.changed }}"
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
---
|
|
||||||
- name: Install Kea packages
|
|
||||||
become: true
|
|
||||||
when: ansible_facts['distribution'] == "Debian"
|
|
||||||
block:
|
|
||||||
- name: Install Kea dhcp4
|
|
||||||
when: kea_dhcp__dhcp4.enable
|
|
||||||
ansible.builtin.apt:
|
|
||||||
name:
|
|
||||||
- isc-kea-dhcp4
|
|
||||||
- name: Install Kea dhcp6
|
|
||||||
when: kea_dhcp__dhcp6.enable
|
|
||||||
ansible.builtin.apt:
|
|
||||||
name:
|
|
||||||
- isc-kea-dhcp6
|
|
||||||
- name: Install Kea ctrl agent
|
|
||||||
when: kea_dhcp__stork_agent.enable
|
|
||||||
ansible.builtin.apt:
|
|
||||||
name:
|
|
||||||
- isc-kea-ctrl-agent
|
|
||||||
- name: Install Kea admin
|
|
||||||
when: kea_dhcp__stork_agent.enable
|
|
||||||
ansible.builtin.apt:
|
|
||||||
name:
|
|
||||||
- isc-kea-admin
|
|
||||||
|
|
@ -1,20 +1,15 @@
|
||||||
---
|
---
|
||||||
- name: Include config vars
|
|
||||||
when: kea_dhcp__include_vars != None
|
|
||||||
ansible.builtin.include_vars:
|
|
||||||
file: "{{ kea_dhcp__include_vars }}"
|
|
||||||
|
|
||||||
- name: Deploy kea-dhcp4 configuration file
|
- name: Deploy kea-dhcp4 configuration file
|
||||||
become: true
|
become: true
|
||||||
when: kea_dhcp__dhcp4.enable
|
when: kea_dhcp__dhcp4.enable
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: kea-dhcp4.conf.jinja
|
src: kea-dhcp4.conf.j2
|
||||||
dest: /etc/kea/kea-dhcp4.conf
|
dest: /etc/kea/kea-dhcp4.conf
|
||||||
backup: true
|
backup: true
|
||||||
owner: root
|
owner: root
|
||||||
group: kea
|
group: "{{ kea_dhcp__service_group }}"
|
||||||
mode: "u=rw,g=r,o="
|
mode: "u=rw,g=r,o="
|
||||||
validate: kea-dhcp4 -T %s
|
validate: "/usr/sbin/kea-dhcp4 -T %s" # does not work with debian apparmor policys
|
||||||
notify:
|
notify:
|
||||||
- Kea_dhcp4.restarted
|
- Kea_dhcp4.restarted
|
||||||
|
|
||||||
|
|
@ -22,13 +17,13 @@
|
||||||
become: true
|
become: true
|
||||||
when: kea_dhcp__dhcp6.enable
|
when: kea_dhcp__dhcp6.enable
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: kea-dhcp6.conf.jinja
|
src: kea-dhcp6.conf.j2
|
||||||
dest: /etc/kea/kea-dhcp6.conf
|
dest: /etc/kea/kea-dhcp6.conf
|
||||||
backup: true
|
backup: true
|
||||||
owner: root
|
owner: root
|
||||||
group: kea
|
group: "{{ kea_dhcp__service_group }}"
|
||||||
mode: "u=rw,g=r,o="
|
mode: "u=rw,g=r,o="
|
||||||
validate: kea-dhcp6 -T %s
|
validate: /usr/sbin/kea-dhcp6 -T %s # does not work with debian apparmor policys
|
||||||
notify:
|
notify:
|
||||||
- Kea_dhcp6.restarted
|
- Kea_dhcp6.restarted
|
||||||
|
|
||||||
|
|
@ -39,9 +34,9 @@
|
||||||
src: kea-ctrl-agent.conf.j2
|
src: kea-ctrl-agent.conf.j2
|
||||||
dest: /etc/kea/kea-ctrl-agent.conf
|
dest: /etc/kea/kea-ctrl-agent.conf
|
||||||
owner: root
|
owner: root
|
||||||
group: kea
|
group: "{{ kea_dhcp__service_group }}"
|
||||||
mode: "u=rw,g=r,o="
|
mode: "u=rw,g=r,o="
|
||||||
validate: kea-ctrl-agent -t %s
|
validate: /usr/sbin/kea-ctrl-agent -t %s # does not work with debian apparmor policys
|
||||||
notify:
|
notify:
|
||||||
- Kea_ctrl.restarted
|
- Kea_ctrl.restarted
|
||||||
- Stork_agent.restarted
|
- Stork_agent.restarted
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,20 @@
|
||||||
---
|
---
|
||||||
|
- name: Include config vars
|
||||||
|
when: kea_dhcp__include_vars != None
|
||||||
|
ansible.builtin.include_vars:
|
||||||
|
file: "{{ kea_dhcp__include_vars }}"
|
||||||
|
|
||||||
|
- name: Merge default vars with host_vars
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
kea_dhcp__stork_agent: "{{ kea_dhcp__stork_agent_defaults | combine(kea_dhcp__stork_agent, recursive=True) }}"
|
||||||
|
kea_dhcp__dhcp4: "{{ kea_dhcp__dhcp4_defaults | combine(kea_dhcp__dhcp4, recursive=True) }}"
|
||||||
|
kea_dhcp__dhcp6: "{{ kea_dhcp__dhcp6_defaults | combine(kea_dhcp__dhcp6, recursive=True) }}"
|
||||||
|
|
||||||
- name: Setup Kea DHCP
|
- name: Setup Kea DHCP
|
||||||
block:
|
block:
|
||||||
- name: Install Kea on Debian
|
- name: Install Kea on Debian
|
||||||
when: ansible_facts['distribution'] == "Debian"
|
when: ansible_facts['distribution'] == "Debian"
|
||||||
ansible.builtin.import_tasks: install_debian.yml
|
ansible.builtin.import_tasks: install_debian.yaml
|
||||||
|
|
||||||
- name: Configure Kea
|
- name: Configure Kea
|
||||||
ansible.builtin.include_tasks: kea.yaml
|
ansible.builtin.include_tasks: kea.yaml
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,39 @@
|
||||||
---
|
---
|
||||||
- name: Install stork-agent
|
- name: Install stork-agent
|
||||||
block:
|
block:
|
||||||
- name: Install isc-stork-agent
|
- name: Install stork-agent on Debian
|
||||||
when: ansible_facts['distribution'] == "Debian"
|
when: ansible_facts['distribution'] == "Debian"
|
||||||
|
block:
|
||||||
|
- name: Register isc-stork apt repository
|
||||||
|
become: true
|
||||||
|
register: "kea_dhcp_install_repo"
|
||||||
|
ansible.builtin.deb822_repository:
|
||||||
|
name: isc-stork
|
||||||
|
uris: https://dl.cloudsmith.io/public/isc/stork/deb/debian
|
||||||
|
suites: any-version
|
||||||
|
components: main
|
||||||
|
signed_by: https://dl.cloudsmith.io/public/isc/stork/gpg.key
|
||||||
|
|
||||||
|
- name: Install isc-stork-agent
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
name: isc-stork-agent
|
name: isc-stork-agent
|
||||||
|
update_cache: "{{ kea_dhcp_install_repo.changed }}"
|
||||||
|
|
||||||
- name: Add stork-agent user to _kea group on Debian
|
- name: Add stork-agent user to kea group on Debian
|
||||||
when: ansible_facts['distribution'] == "Debian"
|
when: ansible_facts['distribution'] == "Debian"
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
name: stork-agent
|
name: stork-agent
|
||||||
groups: [ "_kea" ]
|
groups: [ "{{ kea_dhcp__service_group }}" ]
|
||||||
append: true
|
append: true
|
||||||
|
|
||||||
- name: Config for stork-agent
|
- name: Config for stork-agent
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: stork-agent.env.jinja
|
src: stork-agent.env.j2
|
||||||
dest: /etc/stork/agent.env
|
dest: /etc/stork/agent.env
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: "{{ kea_dhcp__service_group }}"
|
||||||
mode: "0660"
|
mode: "0660"
|
||||||
notify:
|
notify:
|
||||||
- Systemd_daemon_reload
|
- Systemd_daemon_reload
|
||||||
|
|
|
||||||
32
roles/kea_dhcp/templates/kea-dhcp4.conf.j2
Normal file
32
roles/kea_dhcp/templates/kea-dhcp4.conf.j2
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
"Dhcp4": {
|
||||||
|
"interfaces-config": {
|
||||||
|
"interfaces": {{ kea_dhcp__dhcp4.interfaces | to_nice_json | indent(12) }}
|
||||||
|
},
|
||||||
|
"control-sockets": {{ kea_dhcp__dhcp4['control-sockets'] | to_nice_json | indent(8) }},
|
||||||
|
"lease-database": {{ kea_dhcp__dhcp4['lease-database'] | to_nice_json | indent(8) }},
|
||||||
|
{% if kea_dhcp__dhcp4['hooks-libraries'] is defined and kea_dhcp__dhcp4['hooks-libraries'] %}
|
||||||
|
"hooks-libraries": {{ kea_dhcp__dhcp4['hooks-libraries'] | to_nice_json | indent(8) }},
|
||||||
|
{% endif %}
|
||||||
|
{% if kea_dhcp__dhcp4['option-data'] is defined and kea_dhcp__dhcp4['option-data'] %}
|
||||||
|
"option-data": {{ kea_dhcp__dhcp4['option-data'] | to_nice_json | indent(8) }},
|
||||||
|
{% endif %}
|
||||||
|
"loggers": {{ kea_dhcp__dhcp4['logging'] | to_nice_json | indent(8) }},
|
||||||
|
"subnet4": [
|
||||||
|
{% for subnet in kea_dhcp__dhcp4.subnets %}
|
||||||
|
{
|
||||||
|
"id": {{ subnet.id }},
|
||||||
|
"subnet": "{{ subnet.subnet }}",
|
||||||
|
"pools": {{ subnet.pools | to_nice_json | indent(16) }},
|
||||||
|
{% if subnet.reservations is defined and subnet.reservations %}
|
||||||
|
"reservations": {{ subnet.reservations | to_nice_json | indent(16) }},
|
||||||
|
{% endif %}
|
||||||
|
{% if subnet['option-data'] is defined and subnet['option-data'] %}
|
||||||
|
"option-data": {{ subnet['option-data'] | to_nice_json | indent(16) }}
|
||||||
|
{% endif %}
|
||||||
|
}{% if not loop.last %},{% endif %}
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
{
|
|
||||||
"Dhcp4": {
|
|
||||||
"interfaces-config": {
|
|
||||||
"interfaces": {{ kea_dhcp__dhcp4.interfaces | to_nice_json }}
|
|
||||||
},
|
|
||||||
"control-sockets": {{ kea_dhcp__dhcp4['control-sockets'] | to_nice_json }},
|
|
||||||
"lease-database": {{ kea_dhcp__dhcp4['lease-database'] | to_nice_json }},
|
|
||||||
{% if kea_dhcp__dhcp4['option-data'] is defined and kea_dhcp__dhcp4['option-data'] %}
|
|
||||||
"option-data": {{ kea_dhcp__dhcp4['option-data'] | to_nice_json }},
|
|
||||||
{% endif %}
|
|
||||||
"subnet4": [
|
|
||||||
{% for subnet in kea_dhcp__dhcp4.subnets %}
|
|
||||||
{
|
|
||||||
"id": {{ subnet.id }},
|
|
||||||
"subnet": "{{ subnet.subnet }}",
|
|
||||||
"pools": {{ subnet.pools | to_nice_json }},
|
|
||||||
{% if subnet.reservations is defined and subnet.reservations %}
|
|
||||||
"reservations": {{ subnet.reservations | to_nice_json }},
|
|
||||||
{% endif %}
|
|
||||||
{% if subnet['option-data'] is defined and subnet['option-data'] %}
|
|
||||||
"option-data": {{ subnet['option-data'] | to_nice_json }}
|
|
||||||
{% endif %}
|
|
||||||
}{% if not loop.last %},{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
36
roles/kea_dhcp/templates/kea-dhcp6.conf.j2
Normal file
36
roles/kea_dhcp/templates/kea-dhcp6.conf.j2
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"Dhcp6": {
|
||||||
|
"interfaces-config": {
|
||||||
|
"interfaces": {{ kea_dhcp__dhcp6.interfaces | to_nice_json | indent(12) }}
|
||||||
|
},
|
||||||
|
"control-sockets": {{ kea_dhcp__dhcp6['control-sockets'] | to_nice_json | indent(8) }},
|
||||||
|
"lease-database": {{ kea_dhcp__dhcp6['lease-database'] | to_nice_json | indent(8) }},
|
||||||
|
{% if kea_dhcp__dhcp6['hooks-libraries'] is defined and kea_dhcp__dhcp6['hooks-libraries'] %}
|
||||||
|
"hooks-libraries": {{ kea_dhcp__dhcp6['hooks-libraries'] | to_nice_json | indent(8) }},
|
||||||
|
{% endif %}
|
||||||
|
{% if kea_dhcp__dhcp6['option-data'] is defined and kea_dhcp__dhcp6['option-data'] %}
|
||||||
|
"option-data": {{ kea_dhcp__dhcp6['option-data'] | to_nice_json | indent(8) }},
|
||||||
|
{% endif %}
|
||||||
|
"loggers": {{ kea_dhcp__dhcp6['logging'] | to_nice_json | indent(8) }}{% if kea_dhcp__dhcp6.subnets is defined and kea_dhcp__dhcp6.subnets %},{% endif %}
|
||||||
|
{% if kea_dhcp__dhcp6.subnets is defined and kea_dhcp__dhcp6.subnets %}
|
||||||
|
"subnet6": [
|
||||||
|
{% for subnet in kea_dhcp__dhcp6.subnets %}
|
||||||
|
{
|
||||||
|
"id": {{ subnet.id }},
|
||||||
|
"subnet": "{{ subnet.subnet }}",
|
||||||
|
"interface": "{{ subnet.interface }}",
|
||||||
|
"allocator": "{{ subnet.allocator | default("iterative") }}",
|
||||||
|
"pools": {{ subnet.pools | to_nice_json | indent(16) }},
|
||||||
|
{% if subnet.reservations is defined and subnet.reservations %}
|
||||||
|
"reservations": {{ subnet.reservations | to_nice_json | indent(16) }},
|
||||||
|
{% endif %}
|
||||||
|
{% if subnet['option-data'] is defined and subnet['option-data'] %}
|
||||||
|
"option-data": {{ subnet['option-data'] | to_nice_json | indent(16) }}
|
||||||
|
{% endif %}
|
||||||
|
}{% if not loop.last %},{% endif %}
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
]
|
||||||
|
{% endif %}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
{
|
|
||||||
"Dhcp6": {
|
|
||||||
"interfaces-config": {
|
|
||||||
"interfaces": {{ kea_dhcp__dhcp6.interfaces | to_nice_json }}
|
|
||||||
},
|
|
||||||
"control-sockets": {{ kea_dhcp__dhcp6['control-sockets'] | to_nice_json }},
|
|
||||||
"lease-database": {{ kea_dhcp__dhcp6['lease-database'] | to_nice_json }},
|
|
||||||
{% if kea_dhcp__dhcp6['option-data'] is defined and kea_dhcp__dhcp6['option-data'] %}
|
|
||||||
"option-data": {{ kea_dhcp__dhcp6['option-data'] | to_nice_json }},
|
|
||||||
{% endif %}
|
|
||||||
"subnet6": [
|
|
||||||
{% for subnet in kea_dhcp__dhcp6.subnets %}
|
|
||||||
{
|
|
||||||
"id": {{ subnet.id }},
|
|
||||||
"subnet": "{{ subnet.subnet }}",
|
|
||||||
"pools": {{ subnet.pools | to_nice_json }},
|
|
||||||
{% if subnet.reservations is defined and subnet.reservations %}
|
|
||||||
"reservations": {{ subnet.reservations | to_nice_json }},
|
|
||||||
{% endif %}
|
|
||||||
{% if subnet['option-data'] is defined and subnet['option-data'] %}
|
|
||||||
"option-data": {{ subnet['option-data'] | to_nice_json }}
|
|
||||||
{% endif %}
|
|
||||||
}{% if not loop.last %},{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
44
roles/kea_dhcp/templates/stork-agent.env.j2
Normal file
44
roles/kea_dhcp/templates/stork-agent.env.j2
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
### the IP or hostname to listen on for incoming Stork server connections
|
||||||
|
# STORK_AGENT_HOST=
|
||||||
|
|
||||||
|
### the TCP port to listen on for incoming Stork server connections
|
||||||
|
# STORK_AGENT_PORT=8081
|
||||||
|
|
||||||
|
### listen for commands from the Stork server only, but not for Prometheus requests
|
||||||
|
# STORK_AGENT_LISTEN_STORK_ONLY=true
|
||||||
|
|
||||||
|
{% if kea_dhcp__stork_agent.prometheus_only %}
|
||||||
|
### listen for Prometheus requests only, but not for commands from the Stork server
|
||||||
|
STORK_AGENT_LISTEN_PROMETHEUS_ONLY=true
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
### settings for exporting stats to Prometheus
|
||||||
|
### the IP or hostname on which the agent exports Kea statistics to Prometheus
|
||||||
|
# STORK_AGENT_PROMETHEUS_KEA_EXPORTER_ADDRESS=
|
||||||
|
### the port on which the agent exports Kea statistics to Prometheus
|
||||||
|
# STORK_AGENT_PROMETHEUS_KEA_EXPORTER_PORT=
|
||||||
|
## enable or disable collecting per-subnet stats from Kea
|
||||||
|
# STORK_AGENT_PROMETHEUS_KEA_EXPORTER_PER_SUBNET_STATS=true
|
||||||
|
### the IP or hostname on which the agent exports BIND 9 statistics to Prometheus
|
||||||
|
# STORK_AGENT_PROMETHEUS_BIND9_EXPORTER_ADDRESS=
|
||||||
|
### the port on which the agent exports BIND 9 statistics to Prometheus
|
||||||
|
# STORK_AGENT_PROMETHEUS_BIND9_EXPORTER_PORT=
|
||||||
|
|
||||||
|
### Stork Server URL used by the agent to send REST commands to the server during agent registration
|
||||||
|
# STORK_AGENT_SERVER_URL=
|
||||||
|
|
||||||
|
### skip TLS certificate verification when the Stork Agent connects
|
||||||
|
### to Kea over TLS and Kea uses self-signed certificates
|
||||||
|
# STORK_AGENT_SKIP_TLS_CERT_VERIFICATION=true
|
||||||
|
|
||||||
|
|
||||||
|
### Logging parameters
|
||||||
|
|
||||||
|
### Set logging level. Supported values are: DEBUG, INFO, WARN, ERROR
|
||||||
|
STORK_LOG_LEVEL=DEBUG
|
||||||
|
### disable output colorization
|
||||||
|
# CLICOLOR=false
|
||||||
|
|
||||||
|
### path to the hook directory
|
||||||
|
# STORK_AGENT_HOOK_DIRECTORY=
|
||||||
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
### Stork Agent env file
|
|
||||||
### (created and managed by ansible kea_dhcp role)
|
|
||||||
|
|
||||||
|
|
||||||
{% if kea_dhcp__stork_agent.prometheus_only %}
|
|
||||||
### listen for Prometheus requests only, but not for commands from the Stork server
|
|
||||||
STORK_AGENT_LISTEN_PROMETHEUS_ONLY=true
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
### settings for exporting stats to Prometheus
|
|
||||||
### the IP or hostname on which the agent exports Kea statistics to Prometheus
|
|
||||||
STORK_AGENT_PROMETHEUS_KEA_EXPORTER_ADDRESS=localhost
|
|
||||||
### the port on which the agent exports Kea statistics to Prometheus
|
|
||||||
# STORK_AGENT_PROMETHEUS_KEA_EXPORTER_PORT=
|
|
||||||
|
|
||||||
### Logging parameters
|
|
||||||
|
|
||||||
### Set logging level. Supported values are: DEBUG, INFO, WARN, ERROR
|
|
||||||
STORK_LOG_LEVEL=DEBUG
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue