fix: add check for autoexpand status before enabling on datapool

This commit is contained in:
Menno van Leeuwen 2025-03-12 14:11:25 +01:00
parent 112d3679da
commit ca7061911c
Signed by: vleeuwenmenno
SSH Key Fingerprint: SHA256:OJFmjANpakwD3F2Rsws4GLtbdz1TJ5tkQF0RZmF0TRE

View File

@ -31,10 +31,16 @@
become: true
changed_when: false
- name: Check if autoexpand is enabled
ansible.builtin.command: zpool get -H -o value autoexpand datapool
register: autoexpand_status
become: true
changed_when: false
- name: Enable autoexpand on datapool
ansible.builtin.command: zpool set autoexpand=on datapool
become: true
when: datapool_check.rc == 0
when: autoexpand_status.stdout != "on" and datapool_check.rc == 0
register: autoexpand_result
changed_when: autoexpand_result.rc == 0