diff --git a/tasks/jail/create.yml b/tasks/jail/create.yml index 10622d7..141fbf3 100644 --- a/tasks/jail/create.yml +++ b/tasks/jail/create.yml @@ -19,7 +19,7 @@ jail_{{ jail_name }}_new_ip4: '{{ available_jail_ip4 }}' - name: Clone a new ZFS filesystem for the jail - zfs: + community.general.zfs: origin: '{{ template_dataset_root_name }}@{{ latest_snapshot }}' name: '{{ vars["jail_" + jail_name + "_new_dataset_name"] }}' state: present @@ -59,7 +59,7 @@ {{ vars['jail_' + jail_name + '_timezone'|default(vars['default_timezone'])] }} - name: Create config dir for jail - file: + ansible.builtin.file: path: '{{ dynamic_jails_path }}/configs/{{ vars["jail_" + jail_name + "_newest_id"] }}' state: directory diff --git a/tasks/jail/main.yml b/tasks/jail/main.yml index fedb8eb..8f2ad07 100644 --- a/tasks/jail/main.yml +++ b/tasks/jail/main.yml @@ -25,7 +25,7 @@ jail_THIS_with_ip6: "{{ vars['jail_' + jail_name + '_ip6'] | default(False) }}" - name: Ensure config directory exists for the generated jails - file: + ansible.builtin.file: path: '{{ dynamic_jails_path }}/configs' state: directory diff --git a/tasks/jail/teardown.yml b/tasks/jail/teardown.yml index 0b7e528..05ca2a4 100644 --- a/tasks/jail/teardown.yml +++ b/tasks/jail/teardown.yml @@ -40,7 +40,7 @@ loop_var: mountpoint - name: Delete syslog socket and its directory to avoid recreating log socket - file: + ansible.builtin.file: path: '{{ dynamic_jails_path }}/{{ jail_id }}/var/run/log' state: absent @@ -50,19 +50,18 @@ # state: restarted - name: Delete config dir for jail - file: + ansible.builtin.file: path: '{{ dynamic_jails_path }}/configs/{{ jail_id }}' state: absent # FreeBSD 13 started to give errors here, maybe try later -# -# - name: Destroying ZFS dataset {{ dynamic_jails_dataset_name }}/{{ jail_id }} -# zfs: -# name: >- -# {{ dynamic_jails_dataset_name }}/{{ jail_id }} -# state: absent -# register: zfs_destroy -# ignore_errors: yes +- name: Destroying ZFS dataset {{ dynamic_jails_dataset_name }}/{{ jail_id }} + community.general.zfs: + name: >- + {{ dynamic_jails_dataset_name }}/{{ jail_id }} + state: absent + register: zfs_destroy + ignore_errors: yes # Due to a possible bug in the ZFS/FreeBSD kernel, destroying the dataset # sometimes isn't possible after freeing it up. Hence we use '-f' @@ -74,7 +73,7 @@ # ignore_errors: yes - name: Removing jail directory - file: + ansible.builtin.file: path: >- {{ dynamic_jails_path }}/{{ jail_id }} state: absent