community.general.one_image_info 模块 – 收集 OpenNebula 镜像的信息

注意

此模块是 community.general 集合(版本 10.1.0)的一部分。

如果您正在使用 ansible 包,您可能已经安装了此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用: ansible-galaxy collection install community.general。您需要其他要求才能使用此模块,请参阅 要求了解详细信息。

要在 playbook 中使用它,请指定:community.general.one_image_info

概要

  • 收集 OpenNebula 镜像的信息。

要求

以下要求需要在执行此模块的主机上满足。

  • pyone

参数

参数

注释

api_password

别名: api_token

字符串

用于 XMLRPC 身份验证的密码或令牌。

如果未指定,则使用 ONE_PASSWORD 环境变量的值(如果有)。

api_url

别名: api_endpoint

字符串

XMLRPC 服务器的 ENDPOINT URL。

如果未指定,则使用 ONE_URL 环境变量的值(如果有)。

api_username

字符串

用于 XMLRPC 身份验证的用户名。

如果未指定,则使用 ONE_USERNAME 环境变量的值(如果有)。

ids

别名: id

列表 / 元素=字符串

您想要收集事实的镜像 ID 列表。

模块也可以使用整数。

name

字符串

要收集事实的镜像的 name

如果 name~ 开头,则 name 将用作正则表达式模式

它会限制名称与指定正则表达式匹配的镜像列表(将返回其事实)。

此外,如果 name~* 开头,则将执行不区分大小写的匹配。

请参阅示例了解更多详细信息。

validate_certs

布尔值

是否验证 TLS/SSL 证书。

如果使用 PYTHONHTTPSVERIFY 环境变量,则忽略此参数。

选项

  • false

  • true ← (默认)

wait_timeout

整数

在超时之前等待达到所需状态的时间(以秒为单位)。

默认值: 300

属性

属性

支持

描述

check_mode

支持: 完整

此操作不会修改状态。

可以在 check_mode 中运行并返回已更改的状态预测,而不会修改目标。

diff_mode

支持: 不适用

此操作不会修改状态。

在差异模式下,将返回有关已更改(或可能需要在 check_mode 中更改)的详细信息。

示例

- name: Gather facts about all images
  community.general.one_image_info:
  register: result

- name: Print all images facts
  ansible.builtin.debug:
    msg: result

- name: Gather facts about an image using ID
  community.general.one_image_info:
    ids: 123

- name: Gather facts about an image using list of ID
  community.general.one_image_info:
    ids:
      - 123
      - 456
      - 789
      - 0

- name: Gather facts about an image using the name
  community.general.one_image_info:
    name: 'foo-image'
  register: foo_image

- name: Gather facts about all IMAGEs whose name matches regex 'app-image-.*'
  community.general.one_image_info:
    name: '~app-image-.*'
  register: app_images

- name: Gather facts about all IMAGEs whose name matches regex 'foo-image-.*' ignoring cases
  community.general.one_image_info:
    name: '~*foo-image-.*'
  register: foo_images

返回值

通用返回值已在此处文档化 此处,以下是此模块特有的字段

描述

images

复杂

镜像信息列表

返回: 成功

app_clones

列表 / 元素=整数

在 community.general 9.5.0 中添加

镜像的 app_clones ID 列表。

返回: 成功

示例: [1, 2, 3]

clones

列表 / 元素=整数

在 community.general 9.5.0 中添加

镜像的克隆 ID 列表。

返回: 成功

示例: [1, 2, 3]

cloning_id

整数

在 community.general 9.5.0 中添加

镜像的克隆 ID。

返回: 成功

示例: -1

cloning_ops

整数

在 community.general 9.5.0 中添加

镜像的每秒克隆操作数。

返回: 成功

示例: 0

datastore

整数

在 community.general 9.5.0 中添加

镜像的数据存储名称。

返回: 成功

示例: "image_datastore"

datastore_id

整数

在 community.general 9.5.0 中添加

镜像的数据存储 ID。

返回: 成功

示例: 100

disk_type

整数

在 community.general 9.5.0 中添加

镜像的格式类型。

返回: 成功

示例: 0

fstype

字符串

在 community.general 9.5.0 中添加

镜像的文件系统类型。

返回: 成功

示例: "ext4"

group_id

整数

镜像的组 ID。

返回: 成功

示例: 1

group_name

字符串

镜像的组名称。

返回: 成功

示例: "one-users"

id

整数

镜像的 ID。

返回: 成功

示例: 153

name

字符串

镜像的名称。

返回: 成功

示例: "app1"

owner_id

整数

镜像的所有者 ID。

返回: 成功

示例: 143

owner_name

字符串

镜像的所有者名称。

返回: 成功

示例: "ansible-test"

path

字符串

在 community.general 9.5.0 中添加

镜像的文件系统路径。

返回: 成功

示例: "/var/tmp/hello.qcow2"

permissions

字典

在 community.general 9.5.0 中添加

镜像的权限。

返回: 成功

示例: {"group_a": 0, "group_m": 0, "group_u": 0, "other_a": 0, "other_m": 0, "other_u": 0, "owner_a": 0, "owner_m": 0, "owner_u": 1}

group_a

字符串

镜像的组管理员权限。

返回: 成功

示例: "0"

group_m

字符串

镜像的组管理权限。

返回: 成功

示例: "0"

group_u

字符串

镜像的组使用权限。

返回: 成功

示例: "0"

other_a

字符串

镜像的其他用户管理员权限。

返回: 成功

示例: "0"

other_m

字符串

镜像的其他用户管理权限。

返回: 成功

示例: "0"

other_u

字符串

镜像的其他用户使用权限。

返回: 成功

示例: "0"

owner_a

字符串

镜像的所有者管理员权限。

返回: 成功

示例: "0"

owner_m

字符串

镜像的所有者管理权限。

返回: 成功

示例: "0"

owner_u

字符串

镜像的所有者使用权限。

返回: 成功

示例: "1"

persistent

整数

在 community.general 9.5.0 中添加

镜像的持久性状态(1表示真,0表示假)。

返回: 成功

示例: 1

running_vms

整数

使用此镜像的正在运行的虚拟机数量。

返回: 成功

示例: 7

size

整数

在 community.general 9.5.0 中添加

镜像的大小,单位为兆字节。

返回: 成功

示例: 10000

snapshots

列表 / 元素=字符串

在 community.general 9.5.0 中添加

镜像的快照列表。

返回: 成功

示例: [{"active": 1, "allow_orphans": 1, "children": 0, "date": 123123, "name": "SampleName", "parent": 1, "size": 10228}]

source

字符串

在 community.general 9.5.0 中添加

镜像的来源。

返回: 成功

示例: "/var/lib/one//datastores/100/somerandomstringxd"

state

字符串

镜像的状态。

返回: 成功

示例: "READY"

target_snapshot

整数

在 community.general 9.5.0 中添加

镜像的目标快照。

返回: 成功

示例: 1

type

整数

在 community.general 9.5.0 中添加

镜像的类型。

返回: 成功

示例: 0

used

布尔值

镜像的使用状态。

返回: 成功

示例: true

vms

列表 / 元素=整数

在 community.general 9.5.0 中添加

镜像的虚拟机 ID 列表。

返回: 成功

示例: [1, 2, 3]

作者

  • Milan Ilic (@ilicmilan)

  • Jan Meerkamp (@meerkampdvv)