diff options
| author | Jan Tuomi <jan@jantuomi.fi> | 2025-06-24 14:57:10 +0300 |
|---|---|---|
| committer | Jan Tuomi <jan@jantuomi.fi> | 2025-06-24 14:57:10 +0300 |
| commit | 48db9ffeb402ce670ef8283d4ca211d4299ea058 (patch) | |
| tree | 1afaacd8dd63d1708ca8cb472ecf5395907872a2 /tasks/jail_single.yml | |
| parent | 1ae6ea46e91f5fe5074d3ec2fefd87abaa6d695d (diff) | |
Set up jails infra
Diffstat (limited to 'tasks/jail_single.yml')
| -rw-r--r-- | tasks/jail_single.yml | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tasks/jail_single.yml b/tasks/jail_single.yml new file mode 100644 index 0000000..807f6a8 --- /dev/null +++ b/tasks/jail_single.yml @@ -0,0 +1,19 @@ +- name: "Check if jail directory for {{ jail.name }} exists" + shell: zfs list -o name | grep -Fxq "zroot/jails/containers/{{ jail.name }}" + failed_when: false + changed_when: false + register: check_jail_directory + +- name: "ZFS clone snapshot to jail directory for {{ jail.name }}" + shell: zfs clone zroot/jails/templates/14.3-RELEASE@base "zroot/jails/containers/{{ jail.name }}" + when: check_jail_directory.rc != 0 + +- name: "Check if jail {{ jail.name }} is running" + shell: jls -j "{{ jail.name }}" + failed_when: false + changed_when: false + register: check_jail_active + +- name: "Start jail {{ jail.name }}" + shell: service jail start "{{ jail.name }}" + when: check_jail_active.rc != 0 |
