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