community.general.one_image 模块 – 管理 OpenNebula 镜像
注意
此模块是 community.general 集合(版本 10.1.0)的一部分。
如果您使用的是 ansible 包,则可能已经安装了此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install community.general。您需要进一步的要求才能使用此模块,请参阅 要求 了解详情。
要在 playbook 中使用它,请指定:community.general.one_image。
概要
- 管理 OpenNebula 镜像 
要求
在执行此模块的主机上需要以下要求。
- pyone 
参数
| 参数 | 注释 | 
|---|---|
| 用于 XMLRPC 身份验证的密码或令牌。 如果未指定,则使用  | |
| XMLRPC 服务器的 ENDPOINT URL。 如果未指定,则使用  | |
| 用于 XMLRPC 身份验证的用户名。 如果未指定,则使用  | |
| 与  | |
| 镜像是否应该启用或禁用。 选项 
 | |
| 您要管理的镜像的  | |
| 您要管理的镜像的  如果  | |
| 将分配给现有或新镜像的名称。 在克隆的情况下,默认情况下, | |
| 镜像应该是持久的还是非持久的。 选项 
 | |
| 
 
 
 
 选项 
 | |
| 与  | |
| 是否验证 TLS/SSL 证书。 如果使用  选项 
 | |
| 等待镜像准备就绪、删除或克隆的秒数。 默认值:  | 
属性
| 属性 | 支持 | 描述 | 
|---|---|---|
| 支持:完全 | 可以在  | |
| 支持:无 | 在 diff 模式下,当处于  | 
示例
- name: Fetch the IMAGE by id
  community.general.one_image:
    id: 45
  register: result
- name: Print the IMAGE properties
  ansible.builtin.debug:
    var: result
- name: Rename existing IMAGE
  community.general.one_image:
    id: 34
    state: renamed
    new_name: bar-image
- name: Disable the IMAGE by id
  community.general.one_image:
    id: 37
    enabled: false
- name: Make the IMAGE persistent
  community.general.one_image:
    id: 37
    persistent: true
- name: Enable the IMAGE by name
  community.general.one_image:
    name: bar-image
    enabled: true
- name: Clone the IMAGE by name
  community.general.one_image:
    name: bar-image
    state: cloned
    new_name: bar-image-clone
  register: result
- name: Delete the IMAGE by id
  community.general.one_image:
    id: '{{ result.id }}'
    state: absent
- name: Make sure IMAGE is present
  community.general.one_image:
    name: myyy-image
    state: present
    create: true
    datastore_id: 100
    template: |
      PATH = "/var/tmp/image"
      TYPE = "OS"
      SIZE = 20512
      FORMAT = "qcow2"
      PERSISTENT = "Yes"
      DEV_PREFIX = "vd"
- name: Make sure IMAGE is present with a longer timeout
  community.general.one_image:
    name: big-image
    state: present
    create: true
    datastore_id: 100
    wait_timeout: 900
    template: |
      PATH = "https://192.0.2.200/repo/tipa_image.raw"
      TYPE = "OS"
      SIZE = 82048
      FORMAT = "raw"
      PERSISTENT = "Yes"
      DEV_PREFIX = "vd"
返回值
通用返回值在此处记录 此处,以下是此模块独有的字段
| 键 | 描述 | 
|---|---|
| 镜像的权限。 返回: 当  示例:  | |
| 镜像的组管理员权限。 返回: 成功 示例:  | |
| 镜像的组管理权限。 返回: 成功 示例:  | |
| 镜像的组使用权限。 返回: 成功 示例:  | |
| 镜像的其他用户管理员权限 返回: 成功 示例:  | |
| 镜像的其他用户管理权限。 返回: 成功 示例:  | |
| 镜像的其他用户使用权限。 返回: 成功 示例:  | |
| 镜像的所有者管理员权限。 返回: 成功 示例:  | |
| 镜像的所有者管理权限。 返回: 成功 示例:  | |
| 镜像的所有者使用权限。 返回: 成功 示例:  | |
| 镜像的快照列表。 返回: 当  示例:  | |
| 镜像的来源。 返回: 当  示例:  | |
