community.general.smartos_image_info 模块 – 获取 SmartOS 镜像详情

注意

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

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

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

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

概要

  • 检索有关 SmartOS 上所有已安装镜像的信息。

参数

参数

注释

filters

字符串

选择镜像的标准。可以是镜像清单中的任何值以及 published_datepublishedsourceclonessize。更多信息可以在 https://smartos.org/man/1m/imgadmimgadm list 下找到。

属性

属性

支持

描述

check_mode

支持:完整

在 community.general 3.3.0 中添加

此操作不修改状态。

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

diff_mode

支持: 不适用

此操作不修改状态。

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

示例

- name: Return information about all installed images
  community.general.smartos_image_info:
  register: result

- name: Return all private active Linux images
  community.general.smartos_image_info:
    filters: "os=linux state=active public=false"
  register: result

- name: Show, how many clones does every image have
  community.general.smartos_image_info:
  register: result

- name: Print information
  ansible.builtin.debug:
    msg: "{{ result.smartos_images[item]['name'] }}-{{ result.smartos_images[item]['version'] }}
         has {{ result.smartos_images[item]['clones'] }} VM(s)"
  with_items: "{{ result.smartos_images.keys() | list }}"

- name: Print information
  ansible.builtin.debug:
    msg: "{{ smartos_images[item]['name'] }}-{{ smartos_images[item]['version'] }}
         has {{ smartos_images[item]['clones'] }} VM(s)"
  with_items: "{{ smartos_images.keys() | list }}"

作者

  • Adam Števko (@xen0l)