blob: 97ba8c6d6dab11893b6ccef76f2f6a09665a8714 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
- name: Check ZFS pool existance
command: zpool list -Ho name {{ zpool.name }}
register: result_pool_list
ignore_errors: true
changed_when: false
- name: Create ZFS pool
command: >-
zpool create
{% if zpool.options is defined and zpool.options | length > 0 %}-o {{ zpool.options | join(' -o ') }}{% endif %}
{% if zpool.mountpoint %}-m {{ zpool.mountpoint }}{% endif %}
{{ zpool.name }}
{% if zpool.mode is defined %}{{ zpool.mode }}{% endif %}
{{ zpool.devices | join(' ') }}
when:
- zpool.state | default('present') == 'present'
- result_pool_list.rc == 1
- name: Destroy ZFS pool
command: zpool destroy {{ zpool.name }}
when:
- zpool.state | default('present') == 'absent'
- result_pool_list.rc == 0
|