#!/bin/bash # {{ ansible_managed }} {% if (lxd_storage_backend == "zfs" or lxd_storage_backend == "dir") %} # This is a script to configure lxd system settings. # "/usr/bin/lxd init" /usr/bin/lxd init \ --auto \ --network-address={{ lxd_bind_address }} \ --network-port={{ lxd_bind_port }} \ --storage-backend={{ lxd_storage_backend }} \ {% if lxd_init_storage_pool is defined %} --storage-pool={{ lxd_init_storage_pool }} \ {% endif %} {% if lxd_storage_create_device is defined %} --storage-create-device={{ lxd_storage_create_device }} \ {% endif %} --trust-password={{ lxd_trust_password }} {% elif (lxd_storage_backend == "btrfs") %} # Check if filesystem if mounted as btrfs. # If not nothing happens and storage will still be set to dir by default if [ $(findmnt /var/lib/lxd -o FSTYPE -n) == "btrfs" ]; then systemctl restart lxd fi {% endif %}