fix: Include rules or tables

This commit is contained in:
pulsar89.5 2023-12-29 11:18:06 +01:00
parent 2ee5dc5ff2
commit 3b43364789

View File

@ -1,16 +1,6 @@
---
# tasks file for nftables
- name: Déployer la configuration générale
ansible.builtin.template:
owner: root
group: root
mode: u=rw,g=,o=
src: nftables.conf.j2
dest: /etc/nftables.conf
become: true
notify: Redémarrer nftables.service
- name: Construire la liste des règles
ansible.builtin.set_fact:
nftables_rules: "{{ nftables_rules + specific }}"
@ -27,13 +17,23 @@
vars:
specific: "{{ lookup('ansible.builtin.vars', item, default='') }}"
- name: Déployer la configuration générale
ansible.builtin.template:
owner: root
group: root
mode: u=rw,g=,o=
src: nftables.conf.j2
dest: /etc/nftables.conf
become: true
notify: Redémarrer nftables.service
- name: Déployer les règles
ansible.builtin.template:
owner: root
group: root
mode: u=rw,g=,o=
src: "{{ role_path }}/templates/rules.conf.j2"
dest: "/srv/nftables/rules.conf"
src: rules.conf.j2
dest: /srv/nftables/rules.conf
when: nftables_rules | length > 0
become: true
notify: Redémarrer nftables.service