feat: Merge rules and tables in one file
This commit is contained in:
parent
35d31eb752
commit
38e9e5aa38
@ -27,18 +27,15 @@
|
|||||||
vars:
|
vars:
|
||||||
specific: "{{ lookup('ansible.builtin.vars', item, default='') }}"
|
specific: "{{ lookup('ansible.builtin.vars', item, default='') }}"
|
||||||
|
|
||||||
- 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: "{{ role_path }}/templates/rules.conf.j2"
|
||||||
dest: "/srv/nftables/rules_{{ item.filename }}.conf"
|
# dest: "/srv/nftables/rules.conf"
|
||||||
loop: "{{ nftables_rules }}"
|
# become: true
|
||||||
loop_control:
|
# notify: Redémarrer nftables.service
|
||||||
label: "{{ item.filename }}"
|
|
||||||
become: true
|
|
||||||
notify: Redémarrer nftables.service
|
|
||||||
|
|
||||||
- name: Déployer les tables
|
- name: Déployer les tables
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
|
@ -16,8 +16,8 @@ table inet filter {
|
|||||||
# accept neighbour discovery otherwise IPv6 connectivity breaks.
|
# accept neighbour discovery otherwise IPv6 connectivity breaks.
|
||||||
ip6 nexthdr icmpv6 icmpv6 type {nd-neighbor-solicit, nd-router-advert, nd-neighbor-advert} accept
|
ip6 nexthdr icmpv6 icmpv6 type {nd-neighbor-solicit, nd-router-advert, nd-neighbor-advert} accept
|
||||||
|
|
||||||
# include specifics rules
|
# include specific rules
|
||||||
include "/srv/nftables/rules_*.conf"
|
include "/srv/nftables/rules.conf"
|
||||||
|
|
||||||
# count and drop any other traffic
|
# count and drop any other traffic
|
||||||
counter drop
|
counter drop
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
{% for rule in item.rules %}
|
{% for item in nftables_rules %}
|
||||||
{{ rule }}
|
# {{ item.comment }}
|
||||||
|
{{ item.rules | join('\n') }}
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
Reference in New Issue
Block a user