community.general.xenserver_facts 模块 – 获取 XenServer 上报告的事实

注意

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

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

要安装它,请使用: ansible-galaxy collection install community.general

要在剧本中使用它,请指定: community.general.xenserver_facts

概要

  • 读取 XenAPI 中的数据,可以用作多个 xe 命令的替代。

属性

属性

支持

描述

check_mode

支持:完全支持

在 community.general 3.3.0 中添加

此操作不会修改状态。

可以在 check_mode 下运行,并在不修改目标的情况下返回更改状态预测。

diff_mode

支持:N/A

此操作不会修改状态。

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

facts

支持:完全支持

操作返回一个 ansible_facts 字典,该字典将更新现有的主机事实。

示例

- name: Gather facts from xenserver
  community.general.xenserver_facts:

- name: Print running VMs
  ansible.builtin.debug:
    msg: "{{ item }}"
  with_items: "{{ xs_vms.keys() }}"
  when: xs_vms[item]['power_state'] == "Running"

# Which will print:
#
# TASK: [Print running VMs] ***********************************************************
# skipping: [10.13.0.22] => (item=CentOS 4.7 (32-bit))
# ok: [10.13.0.22] => (item=Control domain on host: 10.0.13.22) => {
#     "item": "Control domain on host: 10.0.13.22",
#     "msg": "Control domain on host: 10.0.13.22"
# }

作者

  • Andy Hill (@andyhky)

  • Tim Rupp (@caphrim007)

  • Robin Lee (@cheese)