community.general.imgadm 模块 – 管理 SmartOS 镜像

注意

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

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

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

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

概要

  • 通过 imgadm(1M) 管理 SmartOS 虚拟机镜像

参数

参数

注释

force

布尔值

强制执行给定操作(imgadm(1M) 支持时)。

选项

  • false

  • true

pool

字符串

导入或从中删除镜像的 zpool。

默认值: "zones"

source

字符串

镜像源的 URI。

state

字符串 / 必需

操作对象应处于的状态。 importedpresent 的别名, deletedabsent 的别名。设置为 vacuumeduuid=* 时,它将删除所有未使用的镜像。

选项

  • "present"

  • "absent"

  • "deleted"

  • "imported"

  • "updated"

  • "vacuumed"

type

字符串

镜像源的类型。

选项

  • "imgapi" ← (默认)

  • "docker"

  • "dsapi"

uuid

字符串

镜像 UUID。可以是完整的 UUID 或 *(表示所有镜像)。

属性

属性

支持

描述

check_mode

支持:不支持

可以在 check_mode 下运行并返回更改状态预测,而无需修改目标。

diff_mode

支持:不支持

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

示例

- name: Import an image
  community.general.imgadm:
    uuid: '70e3ae72-96b6-11e6-9056-9737fd4d0764'
    state: imported

- name: Delete an image
  community.general.imgadm:
    uuid: '70e3ae72-96b6-11e6-9056-9737fd4d0764'
    state: deleted

- name: Update all images
  community.general.imgadm:
    uuid: '*'
    state: updated

- name: Update a single image
  community.general.imgadm:
    uuid: '70e3ae72-96b6-11e6-9056-9737fd4d0764'
    state: updated

- name: Add a source
  community.general.imgadm:
    source: 'https://datasets.project-fifo.net'
    state: present

- name: Add a Docker source
  community.general.imgadm:
    source: 'https://docker.io'
    type: docker
    state: present

- name: Remove a source
  community.general.imgadm:
    source: 'https://docker.io'
    state: absent

返回值

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

描述

source

字符串

被管理的源。

返回:未管理镜像时。

示例: "https://datasets.project-fifo.net"

state

字符串

执行后目标的状态。

返回:成功

示例: "present"

uuid

字符串

操作的镜像的 UUID。

返回:未管理镜像源时。

示例: "70e3ae72-96b6-11e6-9056-9737fd4d0764"

作者

  • Jasper Lievisse Adriaanse (@jasperla)