community.general.lxd 清单 – 从 lxd 主机返回 Ansible 清单
注意
此清单插件是 community.general 集合(版本 10.1.0)的一部分。
如果您正在使用 ansible 包,您可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install community.general。您需要进一步的要求才能使用此清单插件,有关详细信息,请参阅 要求。
要在 playbook 中使用它,请指定:community.general.lxd。
community.general 3.0.0 中的新增功能
概要
- 从 lxd 获取清单。 
- 使用以“lxd.(yml|yaml)”结尾的 YAML 配置文件。 
要求
在执行此清单的本地控制器节点上需要以下要求。
- ipaddress 
- lxd >= 4.0 
参数
| 参数 | 注释 | 
|---|---|
| 客户端证书文件路径。 默认值:  | |
| 客户端证书密钥文件路径。 默认值:  | |
| 按以下关键字创建组: 有关语法,请参见示例。 | |
| 确保这是“lxd”插件的源文件的令牌。 选项 
 | |
| 如果实例有多个网络接口,则按系列首选哪个接口。 为 IPv4 指定  选项 
 | |
| 如果实例有多个网络接口,请选择哪个接口作为模式。 与可以找到的第一个数字组合,例如 “eth” + 0。 该选项已从  默认值:  | |
| 根据给定的项目过滤实例。 默认值:  | |
| 服务器证书文件路径。 | |
| 此选项控制是否检查服务器的主机名作为 HTTPS 连接验证的一部分。如果例如,提供的服务器证书(请参阅  选项 
 | |
| 根据当前状态过滤实例。 选项 
 | |
| 客户端受信任密码。 在使用此模块之前,您需要在 lxd 服务器上设置此密码,使用以下命令:  如果设置了  | |
| 按类型筛选实例,可选择  inventory 的第一个版本仅支持容器。 选项 
 | |
| lxd 服务器的 Unix 域套接字路径或 https URL。 文件系统中的套接字必须以  通常为  默认值:  | 
示例
# simple lxd.yml
plugin: community.general.lxd
url: unix:/var/snap/lxd/common/lxd/unix.socket
# simple lxd.yml including filter
plugin: community.general.lxd
url: unix:/var/snap/lxd/common/lxd/unix.socket
state: RUNNING
# simple lxd.yml including virtual machines and containers
plugin: community.general.lxd
url: unix:/var/snap/lxd/common/lxd/unix.socket
type_filter: both
# grouping lxd.yml
groupby:
  locationBerlin:
    type: location
    attribute: Berlin
  netRangeIPv4:
    type: network_range
    attribute: 10.98.143.0/24
  netRangeIPv6:
    type: network_range
    attribute: fd42:bd00:7b11:2167:216:3eff::/24
  osUbuntu:
    type: os
    attribute: ubuntu
  testpattern:
    type: pattern
    attribute: test
  profileDefault:
    type: profile
    attribute: default
  profileX11:
    type: profile
    attribute: x11
  releaseFocal:
    type: release
    attribute: focal
  releaseBionic:
    type: release
    attribute: bionic
  typeVM:
    type: type
    attribute: virtual-machine
  typeContainer:
    type: type
    attribute: container
  vlan666:
    type: vlanid
    attribute: 666
  projectInternals:
    type: project
    attribute: internals
