Add support for jail.conf.d files.

This commit is contained in:
Tom Alexander 2022-10-28 21:51:08 -04:00
parent a2945ff069
commit 7db98bc9d1
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
3 changed files with 13 additions and 0 deletions

View File

@ -40,3 +40,5 @@ jail_zfs_dataset: zroot/freebsd/release/jails
jail_zfs_dataset_mountpoint: /jail/main
jail_list:
- name: cloak
conf:
src: cloak

View File

@ -60,6 +60,16 @@
group: wheel
loop: "{{ jail_list|subelements('files', skip_missing=True) }}"
- name: Install jail.conf files
when: item.conf.src is defined
copy:
src: "files/jails/{{ item.conf.src }}.conf"
dest: "/etc/jail.conf.d/{{ item.conf.dest|default(item.conf.src) }}.conf"
mode: "0644"
owner: root
group: wheel
loop: "{{ jail_list }}"
- name: Enable Jails
community.general.sysrc:
name: jail_enable
@ -79,3 +89,4 @@
path: /etc/rc.conf.d/jail
state: absent
when: jail_list|community.general.json_query('[?enabled==`true`]')|length == 0