gliech.lxd

LXD Server Ansible Role

This Ansible role installs LXD using the system's package manager and sets it up with a preseed configuration.

Requirements

No requirements.

Role Variables

Name Required Type / Choices Description
lxd_config yes object This is the LXD preseed configuration object. For more details, check the LXD documentation. To ensure idempotency, do not leave out any values from lxd init --dump.
Example:
yaml <br> config: {} <br> networks: <br> - config: <br> ipv4.address: none <br> ipv4.nat: "true" <br> ipv6.address: none <br> ipv6.nat: "true" <br> description: "" <br> name: lxdbr0 <br> type: bridge <br> project: default <br> storage_pools: <br> - config: <br> source: /var/lib/lxd/storage-pools/default <br> description: "" <br> name: default <br> driver: dir <br> profiles: <br> - config: <br> security.idmap.isolated: "true" <br> description: Default LXD profile <br> devices:<br> eth0: <br> name: eth0 <br> network: lxdbr0 <br> type: nic <br> root: <br> path: / <br> pool: default <br> type: disk <br> name: default <br> projects: <br> - config: <br> features.images: "true" <br> features.networks: "true" <br> features.networks.zones: "true" <br> features.profiles: "true" <br> features.storage.buckets: "true" <br> features.storage.volumes: "true" <br> description: Default LXD project <br> name: default <br>
lxd_extra_users no list(string) This role automatically adds the ansible user to the lxd group for LXD socket communication. You can add more user names to this group using this variable.
Default: []
lxd_subid_offset no integer This is the offset for subordinate user IDs and groups defined in /etc/subuid and /etc/subgid.
Default: 1000000
lxd_subid_range no integer This is the range for subordinate user IDs and groups in /etc/subuid and /etc/subgid.
Default: 6553600

Dependencies

No dependencies.

Example Playbook

Here’s a simple playbook example:

- hosts: container_host
  tasks:
    - ansible.builtin.import_role:
        name: gliech.lxd
      vars:
        lxd_config:
          config: {}
          networks: []
          storage_pools:
            - config:
                source: /var/lib/lxd/storage-pools/default
              description: ""
              name: default
              driver: dir
          profiles:
            - config:
                security.privileged: "true"
              description: Default LXD profile
              devices:
                root:
                  path: /
                  pool: default
                  type: disk
              name: default
          projects:
            - config:
                features.images: "true"
                features.networks: "true"
                features.networks.zones: "true"
                features.profiles: "true"
                features.storage.buckets: "true"
                features.storage.volumes: "true"
              description: Default LXD project
              name: default

License

This project is licensed under the GNU General Public License v3.0.

Informazioni sul progetto

Install lxd from the os package manager and configure it using a preseed object.

Installa
ansible-galaxy install gliech.lxd
Licenza
gpl-3.0
Download
277
Proprietario