2
submitted 3 weeks ago by [email protected] to c/[email protected]

Hello,

I need some help here. I've been trying to write my own Ansible playbook to setup my homeserver. The storage devices on this server are 1 NVMe SSD and 2 HDDs which I want to setup as a mirror. I want to setup all storage devices as either BTRFS or ZFS but I'm having trouble finding the correct modules to use in Ansible for this.

I have also found some roles in Ansible Galaxy but those are either not explained enough for me to use and seem overwhelming to use (especially in comparison to the terminal commands that are needed to setup the BTRFS volumes or ZFS pools). But just using the builtin command module in Ansible somehow feels wrong and not the right way to go about this.

Can someone point me in the right direction? Right now I think I will prefer using BTRFS.

top 2 comments
sorted by: hot top controversial new old
[-] [email protected] 1 points 2 weeks ago

I couldn't find any ansible modules for managing ZFS so I ended up doing it using the command module which is rather clunky and prone to exceptions I hadn't thought of.

- name: Import zfs pool
  ansible.builtin.command: "zpool import -d /dev/disk/by-id {{ item.name }}"
  become: true
  register: import_result
  changed_when: import_result.rc == 0
[-] [email protected] 2 points 2 weeks ago

I have done the same just with Btrfs now.

this post was submitted on 28 Apr 2024
2 points (100.0% liked)

Ansible

222 readers
1 users here now

# TODO

founded 11 months ago
MODERATORS