I want the equivalent of the following to be generated using the zfs module in ansible, the following works using the command line, but fails on second run as the filesystem already exists.
{{ part_postgres }} is set to /dev/sdb in this instance.
zpool create -O compression=gzip postgres {{ part_postgres }} -O secondarycache=all
Currently in ansible I have:
- name: Create postgres zpool
zfs: name=postgres{{ part_postgres }}
compression=gzip
state=present
secondarycache=all
mountpoint=/postgres
atime=off
Ok - the zfs module won't do it, would need to write a new model for zpool. That said, its easy enough to check for zpool existing using the 'creates' annotation for the command module in ansible:
- name: Create postgres zpool
command: zpool create -O compression=gzip postgres /dev/sdb -o ashift=12 -O secondarycache=all
creates=/postgres
This will check if /postgres exists, and only run the command if it doesn't.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With