vmware.vmware_rest.content_locallibrary_info 模块 – 返回给定的本地库。

注意

此模块是 vmware.vmware_rest 集合 (版本 4.3.0) 的一部分。

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

要安装它,请使用:ansible-galaxy collection install vmware.vmware_rest。您需要其他要求才能使用此模块,请参阅 要求 了解详情。

要在剧本中使用它,请指定:vmware.vmware_rest.content_locallibrary_info

vmware.vmware_rest 2.0.0 中的新增功能

概要

  • 返回给定的本地库。

要求

以下是执行此模块的主机所需的条件。

  • vSphere 7.0.3 或更高版本

  • python >= 3.6

  • aiohttp

参数

参数

注释

library_id

字符串

要返回的本地库的标识符。

此参数必须是由 vmware.vmware_rest.content_library_info 返回的资源的 ID。在 *state=[‘get’]* 时必填

session_timeout

浮点数

vmware.vmware_rest 2.1.0 中新增

客户端会话的超时设置。

整个操作(包括连接建立、请求发送和响应)的最大秒数。

默认值为 300 秒。

vcenter_hostname

字符串 / 必填

vSphere vCenter 的主机名或 IP 地址

如果任务中未指定此值,则将使用环境变量 VMWARE_HOST 的值。

vcenter_password

字符串 / 必填

vSphere vCenter 密码

如果任务中未指定此值,则将使用环境变量 VMWARE_PASSWORD 的值。

vcenter_rest_log_file

字符串

您可以使用此可选参数来设置日志文件的位置。

此文件将用于记录 HTTP REST 交互。

该文件将存储在运行模块的主机上。

如果任务中未指定此值,则将使用

环境变量 VMWARE_REST_LOG_FILE 的值。

vcenter_username

字符串 / 必填

vSphere vCenter 用户名

如果任务中未指定此值,则将使用环境变量 VMWARE_USER 的值。

vcenter_validate_certs

布尔值

允许在 SSL 证书无效时连接。当证书不受信任时,设置为 false

如果任务中未指定此值,则将使用环境变量 VMWARE_VALIDATE_CERTS 的值。

选项

  • false

  • true ← (默认)

备注

注意

  • 在 vSphere 7.0.3 上测试

示例

- name: List Local Content Library
  vmware.vmware_rest.content_locallibrary_info:
  register: my_content_library

- name: List all Local Content Library
  vmware.vmware_rest.content_locallibrary_info:
  register: all_content_libraries

- name: Create a new local content library
  vmware.vmware_rest.content_locallibrary:
    name: local_library_001
    description: automated
    publish_info:
      published: true
      authentication_method: NONE
    storage_backings:
    - datastore_id: "{{ lookup('vmware.vmware_rest.datastore_moid', '/my_dc/datastore/rw_datastore') }}"
      type: DATASTORE
    state: present
  register: ds_lib

- name: Retrieve the local content library information based upon id check mode
  vmware.vmware_rest.content_locallibrary_info:
    library_id: '{{ ds_lib.id }}'
  register: result
  check_mode: true

返回值

常用返回值已在 此处 记录,以下是此模块独有的字段

描述

列表 / 元素=字符串

列出所有本地内容库

返回:成功时

示例: [{"creation_time": "2022-11-23T20:02:22.940Z", "description": "automated", "id": "a66d5c73-57f8-4a3a-9361-292a55f68516", "last_modified_time": "2022-11-23T20:02:22.940Z", "name": "my_library_on_nfs", "publish_info": {"authentication_method": "NONE", "persist_json_enabled": 0, "publish_url": "https://vcenter.test:443/cls/vcsp/lib/a66d5c73-57f8-4a3a-9361-292a55f68516/lib.json", "published": 1, "user_name": "vcsp"}, "server_guid": "52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5", "storage_backings": [{"storage_uri": "nfs://datastore.test/srv/share/content-library", "type": "OTHER"}], "type": "LOCAL", "version": "2"}, {"creation_time": "2022-11-23T20:02:25.134Z", "description": "automated", "id": "3393956a-43ed-4e7f-bd96-eb39bd604445", "last_modified_time": "2022-11-23T20:02:25.134Z", "name": "my_library_on_nfs_0", "publish_info": {"authentication_method": "NONE", "persist_json_enabled": 0, "publish_url": "https://vcenter.test:443/cls/vcsp/lib/3393956a-43ed-4e7f-bd96-eb39bd604445/lib.json", "published": 1, "user_name": "vcsp"}, "server_guid": "52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5", "storage_backings": [{"storage_uri": "nfs://datastore.test/srv/share/content-library", "type": "OTHER"}], "type": "LOCAL", "version": "2"}, {"creation_time": "2022-11-23T20:02:26.342Z", "description": "automated", "id": "87f66f86-c046-45a7-9563-d59ea220babf", "last_modified_time": "2022-11-23T20:02:26.342Z", "name": "my_library_on_nfs_1", "publish_info": {"authentication_method": "NONE", "persist_json_enabled": 0, "publish_url": "https://vcenter.test:443/cls/vcsp/lib/87f66f86-c046-45a7-9563-d59ea220babf/lib.json", "published": 1, "user_name": "vcsp"}, "server_guid": "52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5", "storage_backings": [{"storage_uri": "nfs://datastore.test/srv/share/content-library", "type": "OTHER"}], "type": "LOCAL", "version": "2"}, {"creation_time": "2022-11-23T20:02:27.504Z", "description": "automated", "id": "f6c590c4-ae6d-4ad0-9362-378196e98a3c", "last_modified_time": "2022-11-23T20:02:27.504Z", "name": "my_library_on_nfs_2", "publish_info": {"authentication_method": "NONE", "persist_json_enabled": 0, "publish_url": "https://vcenter.test:443/cls/vcsp/lib/f6c590c4-ae6d-4ad0-9362-378196e98a3c/lib.json", "published": 1, "user_name": "vcsp"}, "server_guid": "52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5", "storage_backings": [{"storage_uri": "nfs://datastore.test/srv/share/content-library", "type": "OTHER"}], "type": "LOCAL", "version": "2"}, {"creation_time": "2022-11-23T20:02:28.821Z", "description": "automated", "id": "e8917499-2a4c-4b70-b39b-ae0caaef89c3", "last_modified_time": "2022-11-23T20:02:28.821Z", "name": "my_library_on_nfs_3", "publish_info": {"authentication_method": "NONE", "persist_json_enabled": 0, "publish_url": "https://vcenter.test:443/cls/vcsp/lib/e8917499-2a4c-4b70-b39b-ae0caaef89c3/lib.json", "published": 1, "user_name": "vcsp"}, "server_guid": "52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5", "storage_backings": [{"storage_uri": "nfs://datastore.test/srv/share/content-library", "type": "OTHER"}], "type": "LOCAL", "version": "2"}, {"creation_time": "2022-11-23T20:02:30.085Z", "description": "automated", "id": "630ebdfe-8913-45d3-aaa8-9c2fdecbb76b", "last_modified_time": "2022-11-23T20:02:30.085Z", "name": "my_library_on_nfs_4", "publish_info": {"authentication_method": "NONE", "persist_json_enabled": 0, "publish_url": "https://vcenter.test:443/cls/vcsp/lib/630ebdfe-8913-45d3-aaa8-9c2fdecbb76b/lib.json", "published": 1, "user_name": "vcsp"}, "server_guid": "52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5", "storage_backings": [{"storage_uri": "nfs://datastore.test/srv/share/content-library", "type": "OTHER"}], "type": "LOCAL", "version": "2"}, {"creation_time": "2022-11-23T20:02:31.482Z", "description": "automated", "id": "a046e2e5-bd55-4d04-9443-750a2ab35a6d", "last_modified_time": "2022-11-23T20:02:31.482Z", "name": "my_library_on_nfs_5", "publish_info": {"authentication_method": "NONE", "persist_json_enabled": 0, "publish_url": "https://vcenter.test:443/cls/vcsp/lib/a046e2e5-bd55-4d04-9443-750a2ab35a6d/lib.json", "published": 1, "user_name": "vcsp"}, "server_guid": "52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5", "storage_backings": [{"storage_uri": "nfs://datastore.test/srv/share/content-library", "type": "OTHER"}], "type": "LOCAL", "version": "2"}, {"creation_time": "2022-11-23T20:02:32.846Z", "description": "automated", "id": "b94383b1-7877-4dbd-8c33-51abc39451ff", "last_modified_time": "2022-11-23T20:02:32.846Z", "name": "my_library_on_nfs_6", "publish_info": {"authentication_method": "NONE", "persist_json_enabled": 0, "publish_url": "https://vcenter.test:443/cls/vcsp/lib/b94383b1-7877-4dbd-8c33-51abc39451ff/lib.json", "published": 1, "user_name": "vcsp"}, "server_guid": "52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5", "storage_backings": [{"storage_uri": "nfs://datastore.test/srv/share/content-library", "type": "OTHER"}], "type": "LOCAL", "version": "2"}, {"creation_time": "2022-11-23T20:02:34.218Z", "description": "automated", "id": "8e3efb68-cb84-4ce0-a65a-6c94cc6e6e00", "last_modified_time": "2022-11-23T20:02:34.218Z", "name": "my_library_on_nfs_7", "publish_info": {"authentication_method": "NONE", "persist_json_enabled": 0, "publish_url": "https://vcenter.test:443/cls/vcsp/lib/8e3efb68-cb84-4ce0-a65a-6c94cc6e6e00/lib.json", "published": 1, "user_name": "vcsp"}, "server_guid": "52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5", "storage_backings": [{"storage_uri": "nfs://datastore.test/srv/share/content-library", "type": "OTHER"}], "type": "LOCAL", "version": "2"}, {"creation_time": "2022-11-23T20:02:35.922Z", "description": "automated", "id": "0b12c0b3-6c6d-448d-9033-e054a70183e7", "last_modified_time": "2022-11-23T20:02:35.922Z", "name": "my_library_on_nfs_8", "publish_info": {"authentication_method": "NONE", "persist_json_enabled": 0, "publish_url": "https://vcenter.test:443/cls/vcsp/lib/0b12c0b3-6c6d-448d-9033-e054a70183e7/lib.json", "published": 1, "user_name": "vcsp"}, "server_guid": "52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5", "storage_backings": [{"storage_uri": "nfs://datastore.test/srv/share/content-library", "type": "OTHER"}], "type": "LOCAL", "version": "2"}, {"creation_time": "2022-11-23T20:02:37.796Z", "description": "automated", "id": "46454797-bbe0-415a-9fe9-3cf2f74a14db", "last_modified_time": "2022-11-23T20:02:37.796Z", "name": "my_library_on_nfs_9", "publish_info": {"authentication_method": "NONE", "persist_json_enabled": 0, "publish_url": "https://vcenter.test:443/cls/vcsp/lib/46454797-bbe0-415a-9fe9-3cf2f74a14db/lib.json", "published": 1, "user_name": "vcsp"}, "server_guid": "52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5", "storage_backings": [{"storage_uri": "nfs://datastore.test/srv/share/content-library", "type": "OTHER"}], "type": "LOCAL", "version": "2"}, {"creation_time": "2022-11-23T20:02:38.976Z", "description": "automated", "id": "209926aa-e3fe-46a5-95f2-501e82a5139b", "last_modified_time": "2022-11-23T20:02:38.976Z", "name": "my_library_on_nfs_10", "publish_info": {"authentication_method": "NONE", "persist_json_enabled": 0, "publish_url": "https://vcenter.test:443/cls/vcsp/lib/209926aa-e3fe-46a5-95f2-501e82a5139b/lib.json", "published": 1, "user_name": "vcsp"}, "server_guid": "52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5", "storage_backings": [{"storage_uri": "nfs://datastore.test/srv/share/content-library", "type": "OTHER"}], "type": "LOCAL", "version": "2"}]

作者

  • Ansible云团队 (@ansible-collections)