Add pflog configuration.

This commit is contained in:
Tom Alexander 2022-10-12 22:11:39 -04:00
parent 6bdbbfa2ac
commit 4d4068c889
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
4 changed files with 55 additions and 0 deletions

View File

@ -4,3 +4,6 @@ zfs_snapshot_datasets:
sshd_enabled: true
sshd_conf: "sshd_config"
pf_config: "homeserver_pf.conf"
pflog_conf:
- name: 0
dev: pflog0

View File

@ -0,0 +1 @@
pflog_conf: []

View File

@ -3,3 +3,14 @@
service:
name: pf
state: reloaded
- name: restart pflog
when: is_pf_running.rc == 0
service:
name: pflog
state: restarted
- name: stop pflog
service:
name: pflog
state: stopped

View File

@ -27,3 +27,43 @@
register: is_pf_running
failed_when: is_pf_running.rc != 0
ignore_errors: true
- name: Enable pflog
notify: restart pflog
community.general.sysrc:
name: pflog_enable
value: "YES"
path: /etc/rc.conf.d/pflog
when: pflog_conf|length > 0
- name: Disable pflog
notify: stop pflog
community.general.sysrc:
name: pflog_enable
value: "NO"
path: /etc/rc.conf.d/pflog
when: pflog_conf|length == 0
- name: Set pflog instances
notify: restart pflog
community.general.sysrc:
name: pflog_instances
value: "{{ pflog_conf|community.general.json_query('[].name')|join(' ') }}"
path: /etc/rc.conf.d/pflog
when: pflog_conf|length > 0
- name: Remove pflog instances
notify: stop pflog
community.general.sysrc:
name: jail_list
state: absent
path: /etc/rc.conf.d/pflog
when: pflog_conf|length == 0
- name: Set pflog device names
notify: restart pflog
community.general.sysrc:
name: "pflog_{{item.name}}_dev"
value: "{{ item.dev }}"
path: /etc/rc.conf.d/pflog
loop: "{{ pflog_conf }}"