nftables(role): introduce role for deploying nftables

This commit is contained in:
June 2025-09-20 21:38:39 +02:00
commit c8fa55fafd
Signed by: june
SSH key fingerprint: SHA256:o9EAq4Y9N9K0pBQeBTqhSDrND5E7oB+60ZNx0U1yPe0
6 changed files with 44 additions and 0 deletions

View file

@ -91,6 +91,8 @@ base_config_hosts:
systemd_networkd_hosts: systemd_networkd_hosts:
hosts: hosts:
router: router:
nftables_hosts:
hosts:
docker_compose_hosts: docker_compose_hosts:
hosts: hosts:
ccchoir: ccchoir:

View file

@ -9,6 +9,11 @@
roles: roles:
- systemd_networkd - systemd_networkd
- name: Ensure nftables deployment on nftables_hosts
hosts: nftables_hosts
roles:
- nftables
- name: Ensure deployment of infrastructure authorized keys - name: Ensure deployment of infrastructure authorized keys
hosts: infrastructure_authorized_keys_hosts hosts: infrastructure_authorized_keys_hosts
roles: roles:

11
roles/nftables/README.md Normal file
View file

@ -0,0 +1,11 @@
# Role `nftables`
Deploys nftables.
## Support Distributions
Should work on Debian-based distributions.
## Required Arguments
- `nftables__config`: nftables configuration to deploy.

View file

@ -0,0 +1,5 @@
- name: Restart nftables service
ansible.builtin.systemd_service:
name: nftables
state: restarted
become: true

View file

@ -0,0 +1,6 @@
argument_specs:
main:
options:
nftables__config:
type: str
required: true

View file

@ -0,0 +1,15 @@
- name: ensure nftables is installed
ansible.builtin.apt:
name: nftables
state: present
become: true
- name: deploy nftables configuration
ansible.builtin.copy:
content: "{{ nftables__config }}"
dest: "/etc/nftables.conf"
mode: "0644"
owner: root
group: root
become: true
notify: Restart nftables service