mrlesmithjr.zfs

Table of Contents generated with DocToc

ansible-zfs

This tool helps you install and set up ZFS on Linux (http://zfsonlinux.org/).

Requirements

You need at least one spare hard drive to create a ZFS pool.

Vagrant

Set up a testing environment using Vagrant.

vagrant up

This command will start a server with some ZFS volumes and iSCSI devices. You can access and use these volumes from the client node by running:

vagrant ssh client
sudo iscsiadm -m discovery -t st -p 192.168.202.201
sudo iscsiadm -m node --login

After logging in, you will see /dev/sdb and /dev/sdc on your client, which you can format and mount.

sudo fdisk -l

Role Variables

Here are some variables you can set up for ZFS:

---
# Default configurations for ansible-zfs

# ZFS filesystems creation
zfs_create_filesystems: false

# ZFS pool creation
zfs_create_pools: false

# ZFS volumes creation
zfs_create_volumes: false
zfs_debian_package_key: http://zfsonlinux.org/4D5843EA.asc
zfs_debian_package_url: http://archive.zfsonlinux.org/debian/pool/main/z/zfsonlinux
zfs_debian_package_version: 6
zfs_debian_package: "zfsonlinux_{{ zfs_debian_package_version }}_all.deb"
zfs_enable_auto_snapshots: true

# Enabling iSCSI target installation
zfs_enable_iscsi: false

# NFS kernel server installation
zfs_enable_nfs: false

# Performance tuning options
zfs_enable_performance_tuning: false

# Samba installation and configuration
zfs_enable_samba: false

# Auto-loading encryption keys on boot
zfs_autoload_encryption_keys: false

# List of filesystems to manage
zfs_filesystems: []

# Install and update ZFS
zfs_install_update: true

# Enable iSCSI target service
zfs_iscsistarget_enable: "{{ zfs_enable_iscsi }}"

# Define your Fully Qualified Domain Name (FQDN)
zfs_iscsistarget_iqn: iqn.2001-04.org.example

# More iSCSI target options
zfs_iscsitarget_max_sleep: 3
zfs_iscsitarget_target_portals:
  - ALL

# Manage ZFS Filesystem mountpoint permissions
zfs_manage_filesystem_permissions: false

# Performance tuning parameters
zfs_performance_tuning:
  - param: zfs_prefetch_disable
    value: 1
  - param: zfs_txg_timeout
    value: 5
  - param: zfs_arc_max
    value: "{{ (ansible_memtotal_mb | int * 1024 * 1024 * 0.5) | round | int }}"
  - param: zfs_arc_meta_limit
    value: "{{ (ansible_memtotal_mb | int * 1024 * 1024 * 0.125) | round | int }}"
  - param: zfs_arc_min
    value: "{{ (ansible_memtotal_mb | int * 1024 * 1024 * 0.0625) | round | int }}"

# List of ZPools to manage
zfs_pools: []

# Global scrub cron job settings
zfs_pools_scrub_cron:
  minute: 0
  hour: 0
  day: *
  month: *
  weekday: sun

# Ubuntu PPA configuration
zfs_ubuntu_ppa: ppa:zfs-native/stable

# List of block device volumes to manage
zfs_volumes: []

# Enable monitoring for ZFS
zfs_enable_monitoring: False

# Monitoring settings
zfs_monitoring_capacity_threshold: 80
zfs_monitoring_scrub_max_age: 8
zfs_monitoring_email_dest: root@localhost

Dependencies

No additional dependencies are required.

Example Playbook

GitHub Example

---
- name: Install ZFS on Linux
  hosts: all
  become: true
  vars:
    - zfs_iscsistarget_iqn: iqn.2001-04.local.vagrant
    - zfs_iscsitarget_target_portals:
        - 192.168.202.0/24
    - zfs_enable_iscsi: true
    - zfs_enable_nfs: true
  roles:
    - role: ansible-zfs

Advanced Example ZPool Creation

zfs_pools: 
  - name: 'SSD-TANK'
    action: 'create'
    options:
      ashift: 13
    compression: 'lz4'
    devices:
      - 'ata-INTEL_SSDSC2BW240A4_CVDA352100YL2403GN'
      - 'ata-INTEL_SSDSC2BW240A4_BTDA329505KM2403GN'
    type: 'raidz2'
    state: 'present'

License

This tool is licensed under the BSD license.

Author Information

Larry Smith Jr.

Informazioni sul progetto

Installs and configures ZFS On Linux (http://zfsonlinux.org/)

Installa
ansible-galaxy install mrlesmithjr.zfs
Licenza
Unknown
Download
484.2k
Proprietario
Doing my thang with #automation #DevOps and cloudy things! Providing hopefully valuable content for others to consume easily and also learn from.