Rewrite nftables.service and improve start in playbook
This commit is contained in:
parent
a35a1f7fed
commit
c5754935f6
5
handlers/main.yml
Normal file
5
handlers/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
- name: Restart-nftables
|
||||
ansible.builtin.systemd_service:
|
||||
daemon_reload: true
|
||||
name: nftables
|
||||
state: restarted
|
|
@ -19,12 +19,7 @@
|
|||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
|
||||
- name: Start nftables
|
||||
ansible.builtin.systemd_service:
|
||||
daemon_reload: true
|
||||
name: crowdsec
|
||||
state: started
|
||||
notify: Restart-nftables
|
||||
|
||||
- name: Create nftables default files
|
||||
ansible.builtin.template:
|
||||
|
@ -35,12 +30,14 @@
|
|||
mode: 0640
|
||||
loop: "{{ nftables_default }}"
|
||||
when: nftables_default is defined
|
||||
notify: Restart-nftables
|
||||
|
||||
- name: Create nftables custom files
|
||||
ansible.builtin.template:
|
||||
src: nftables.j2
|
||||
dest: "/etc/nftables.d/{{ item.name }}.conf"
|
||||
dest: "/etc/nftables.d/{{ item.name }}.nft"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0640
|
||||
loop: "{{ nftables }}"
|
||||
notify: Restart-nftables
|
||||
|
|
|
@ -13,8 +13,8 @@ RemainAfterExit=yes
|
|||
StandardInput=null
|
||||
ProtectSystem=full
|
||||
ProtectHome=true
|
||||
ExecStartPre=/usr/sbin/nft flush ruleset
|
||||
ExecStart=/usr/sbin/nft -f /etc/nftables.conf
|
||||
ExecReload=/usr/sbin/nft -f /etc/nftables.conf
|
||||
ExecStop=/usr/sbin/nft flush ruleset
|
||||
|
||||
[Install]
|
||||
|
|
Loading…
Reference in a new issue