aboutsummaryrefslogtreecommitdiffstats
path: root/tasks/jail_single.yml
blob: f51bc373a4d9257dae85ac55fdaa97de7710b8cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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/{{ jail_userland_version }}@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