WIP: new z9 ccchh router #98

Draft
bitwhisker wants to merge 15 commits from new_ccchh_router into main
8 changed files with 34 additions and 87 deletions
Showing only changes of commit 9bff86df7f - Show all commits

kea_dhcp(role): some fixes and removing arch part

- remove tags from tasks
- remove archlinux part
- use debian default package for kea
bitwhisker 2026-05-25 20:13:29 +02:00
Signed by: bitwhisker
SSH key fingerprint: SHA256:KybIk/tusSKao6eLGY+ILlFa1rCrzwx66/acBAcKUqE

View file

@ -1,7 +1,6 @@
kea_dhcp__stork_agent: kea_dhcp__stork_agent:
enable: false enable: false
prometheus_only: true prometheus_only: true
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"

View file

@ -4,19 +4,19 @@
ansible.builtin.systemd_service: ansible.builtin.systemd_service:
daemon_reload: true daemon_reload: true
- name: Kea_dhcp4.reloaded - name: Kea_dhcp4.restarted
bitwhisker marked this conversation as resolved Outdated

Called "reloaded" even tho the action is restarted. One of them needs to be adjusted.

Called "reloaded" even tho the action is `restarted`. One of them needs to be adjusted.
ansible.builtin.service: ansible.builtin.service:
name: kea-dhcp4 name: kea-dhcp4
state: restarted state: restarted
enabled: true enabled: true
- name: Kea_dhcp6.reloaded - name: Kea_dhcp6.restarted
bitwhisker marked this conversation as resolved Outdated

Same restarted/reloaded comment as above.

Same restarted/reloaded comment as above.
ansible.builtin.service: ansible.builtin.service:
name: kea-dhcp6 name: kea-dhcp6
state: restarted state: restarted
enabled: true enabled: true
- name: Kea_ctrl.reloaded - name: Kea_ctrl.restarted
bitwhisker marked this conversation as resolved Outdated

Same restarted/reloaded comment as above.

Same restarted/reloaded comment as above.
ansible.builtin.systemd: ansible.builtin.systemd:
name: kea-ctrl-agent name: kea-ctrl-agent
state: restarted state: restarted

View file

@ -37,7 +37,7 @@ 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"
@ -85,7 +85,7 @@ 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"

View file

@ -1,8 +0,0 @@
---
- name: Install Kea on Archlinux
when: ansible_facts['distribution'] == "Archlinux"
become: true
community.general.pacman:
name: kea
state: present
update_cache: false

View file

@ -1,22 +1,25 @@
--- ---
- name: Register isc-kea apt repository
become: true
register: kea_dhcp_repo
when: ansible_facts['distribution'] == "Debian"
ansible.builtin.deb822_repository:
name: "isc-{{ kea_dhcp__version_repo }}"
uris: "https://dl.cloudsmith.io/public/isc/{{ kea_dhcp__version_repo }}/deb/debian"
suites: any-version
components: main
signed_by: "https://dl.cloudsmith.io/public/isc/{{ kea_dhcp__version_repo }}/gpg.key"
- name: Install Kea packages - name: Install Kea packages
become: true become: true
when: ansible_facts['distribution'] == "Debian" when: ansible_facts['distribution'] == "Debian"
ansible.builtin.apt: block:
name: - name: Install Kea dhcp4
- isc-kea-dhcp4 when: kea_dhcp__dhcp4.enable
- isc-kea-dhcp6 ansible.builtin.apt:
bitwhisker marked this conversation as resolved Outdated

Do we have a requirement for the more up-to-date version present in the upstream repository or is the one in the Debian repos sufficient?

Do we have a requirement for the more up-to-date version present in the upstream repository or is the one in the Debian repos sufficient?

chris wrote this, I don't know why they thought this would be necessary

@c6ristian

chris wrote this, I don't know why they thought this would be necessary @c6ristian

For Club this properly doesn't matter. This was because the compatibility between different version has history been often Subject to Change. As long as there are no plan to do HA its probably fine.

For Club this properly doesn't matter. This was because the compatibility between different version has history been often Subject to Change. As long as there are no plan to do HA its probably fine.

Alright, gotcha. Then just using the Debian-packaged version nicely saves us adding a repo.

Alright, gotcha. Then just using the Debian-packaged version nicely saves us adding a repo.
- isc-kea-ctrl-agent name:
- isc-kea-admin - isc-kea-dhcp4
update_cache: "{{ kea_dhcp_install_repo.changed }}" - 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:
bitwhisker marked this conversation as resolved Outdated

Since we got granular control over whether to use dhcpv4, v6 or the agent, would it make sense to then also granularly install the relevant packages?
I would think Debian would also automatically start the services, which wouldn't make sense, if no sensible v6 config is present.

Since we got granular control over whether to use dhcpv4, v6 or the agent, would it make sense to then also granularly install the relevant packages? I would think Debian would also automatically start the services, which wouldn't make sense, if no sensible v6 config is present.
- isc-kea-ctrl-agent
- name: Install Kea admin
when: kea_dhcp__stork_agent.enable
ansible.builtin.apt:
name:
- isc-kea-admin

View file

@ -1,12 +1,10 @@
--- ---
- name: Include config vars - name: Include config vars
tags: [ kea, include_vars ]
when: kea_dhcp__include_vars is not None when: kea_dhcp__include_vars is not None
bitwhisker marked this conversation as resolved Outdated

I would rather just stick to only having tags at the playbook level. I don't think this kind granular control for the role is really needed as it the config files also shouldn't trigger a reload, if not changed.

I would rather just stick to only having tags at the playbook level. I don't think this kind granular control for the role is really needed as it the config files also shouldn't trigger a reload, if not changed.

this was just copied from the fux noc ansible, but I can remove it

this was just copied from the fux noc ansible, but I can remove it
ansible.builtin.include_vars: ansible.builtin.include_vars:
file: "{{ kea_dhcp__include_vars }}" file: "{{ kea_dhcp__include_vars }}"
- name: Deploy kea-dhcp4 configuration file - name: Deploy kea-dhcp4 configuration file
tags: [ kea, dhcp4 ]
become: true become: true
when: kea_dhcp__dhcp4.enable when: kea_dhcp__dhcp4.enable
ansible.builtin.template: ansible.builtin.template:
@ -18,10 +16,9 @@
mode: "u=rw,g=r,o=" mode: "u=rw,g=r,o="
validate: kea-dhcp4 -T %s validate: kea-dhcp4 -T %s
notify: notify:
- Kea_dhcp4.reloaded - Kea_dhcp4.restarted
- name: Deploy kea-dhcp6 configuration file - name: Deploy kea-dhcp6 configuration file
tags: [ kea, dhcp6 ]
become: true become: true
when: kea_dhcp__dhcp6.enable when: kea_dhcp__dhcp6.enable
ansible.builtin.template: ansible.builtin.template:
@ -33,10 +30,9 @@
mode: "u=rw,g=r,o=" mode: "u=rw,g=r,o="
validate: kea-dhcp6 -T %s validate: kea-dhcp6 -T %s
notify: notify:
- Kea_dhcp6.reloaded - Kea_dhcp6.restarted
- name: Copy kea-ctrl-agent configuration file - name: Copy kea-ctrl-agent configuration file
tags: [ kea, ctrl-agent ]
become: true become: true
when: kea_dhcp__stork_agent.enable when: kea_dhcp__stork_agent.enable
ansible.builtin.template: ansible.builtin.template:
@ -47,5 +43,5 @@
mode: "u=rw,g=r,o=" mode: "u=rw,g=r,o="
validate: kea-ctrl-agent -t %s validate: kea-ctrl-agent -t %s
notify: notify:
- Kea_ctrl.reloaded - Kea_ctrl.restarted
- Stork_agent.restarted - Stork_agent.restarted

View file

@ -1,11 +1,6 @@
--- ---
- name: Setup Kea DHCP - name: Setup Kea DHCP
tags: [kea, dhcp]
block: block:
- name: Install Kea on Archlinux
when: ansible_facts['distribution'] == "Archlinux"
ansible.builtin.import_tasks: install_archlinux.yml
- 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.yml
bitwhisker marked this conversation as resolved Outdated

Again, getting rid of the Arch Linux logic also greatly simplifies this file.

Again, getting rid of the Arch Linux logic also greatly simplifies this file.

this was just copied from the fux noc ansible, but I can remove it

this was just copied from the fux noc ansible, but I can remove it
@ -14,6 +9,5 @@
ansible.builtin.include_tasks: kea.yaml ansible.builtin.include_tasks: kea.yaml
- name: Run stork-agent tasks - name: Run stork-agent tasks
tags: [stork-agent, monitoring]
when: kea_dhcp__stork_agent.enable when: kea_dhcp__stork_agent.enable
ansible.builtin.include_tasks: stork-agent.yaml ansible.builtin.include_tasks: stork-agent.yaml

View file

@ -1,55 +1,18 @@
--- ---
- name: Install stork-agent - name: Install stork-agent
tags: [stork-agent]
block: block:
- name: Install stork-agent on Archlinux - name: Install isc-stork-agent
when: ansible_facts['distribution'] == "Archlinux"
tags: [stork-agent, archlinux]
block:
- name: Create stork-agent user
ansible.builtin.user:
name: stork-agent
create_home: false
home: "/var/lib/stork-agent"
shell: "/usr/bin/nologin"
system: true
groups: ["kea"]
append: true
- name: Install stork-agent with aur_pkg_install
ansible.builtin.include_role:
name: aur_pkg_install
vars:
aur_pkg_install__pkg_name: "stork-agent"
aur_pkg_install__git_clone_url: "https://ansible:{{ secret__ansible_git_token }}@git.fux-eg.net/aur-mirror/stork-agent.git"
aur_pkg_install__git_ref: "bf96e34"
- name: Install stork-agent on Debian
when: ansible_facts['distribution'] == "Debian" when: ansible_facts['distribution'] == "Debian"
tags: [stork-agent, debian] become: true
block: ansible.builtin.apt:
- name: Register isc-stork apt repository name: isc-stork-agent
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
ansible.builtin.apt:
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" ]
append: true append: true
- name: Config for stork-agent - name: Config for stork-agent