gliech.lxd

LXD 服务器 Ansible 角色

测试与发布

这个 Ansible 角色通过操作系统的包管理器安装 LXD,并使用预设对象进行配置。

需求

无。

角色变量

名称必需类型 / 选择描述
lxd_config 对象

LXD 预设配置对象。有关详细信息,请参见 LXD 文档。如果希望幂等性检查正常工作,您必须确保不漏掉 lxd init --dump 输出的任何值,因为该角色使用这些值与此变量的差异来检测变更。

示例:

config: {}
networks:
  - config:
      ipv4.address: none
      ipv4.nat: "true"
      ipv6.address: none
      ipv6.nat: "true"
    description: ""
    name: lxdbr0
    type: bridge
    project: default
storage_pools:
  - config:
      source: /var/lib/lxd/storage-pools/default
    description: ""
    name: default
    driver: dir
profiles:
  - config:
      security.idmap.isolated: "true"
    description: 默认的 LXD 配置文件
    devices:
      eth0:
        name: eth0
        network: lxdbr0
        type: nic
      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: 默认的 LXD 项目
    name: default
lxd_extra_users 列表(字符串)

该角色将始终将 ansible 用户添加到 lxd 组,以便它可以通过 lxd Unix 套接字与该角色中执行的某些任务进行通信。您可以选择使用此变量指定要添加到组中的其他用户名。

默认值: []

lxd_subid_offset 整数

/etc/subuid/etc/subgid 中为从属用户 ID 和从属组 ID 配置的偏移量。

默认值: 1000000

lxd_subid_range 整数

/etc/subuid/etc/subgid 中为从属用户 ID 和从属组 ID 配置的范围。

默认值: 6553600

依赖

无。

示例剧本

- 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: 默认的 LXD 配置文件
              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: 默认的 LXD 项目
              name: default

许可证

本项目根据 GNU 通用公共许可证 v3.0 进行许可。

关于项目

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

安装
ansible-galaxy install gliech.lxd
许可证
gpl-3.0
下载
277
拥有者