containers.podman.podman_pod_info 模块 – 收集有关 podman pod 的信息

注意

此模块是 containers.podman 集合(版本 1.16.2)的一部分。

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

要安装它,请使用: ansible-galaxy collection install containers.podman。您需要进一步的要求才能使用此模块,请参阅要求了解详细信息。

要在 playbook 中使用它,请指定: containers.podman.podman_pod_info

containers.podman 1.0.0 中的新增功能

概要

  • 使用 podman inspect 命令收集有关 podman pod 的信息。

要求

在执行此模块的主机上需要满足以下要求。

  • 主机上安装了 Podman

参数

参数

注释

executable

字符串

如果 podman 可执行文件不在运行 podman 的机器上的 $PATH 中,则指定它的路径

默认值: "podman"

name

字符串

pod 的名称

示例

- name: Gather info about all present pods
  containers.podman.podman_pod_info:

- name: Gather info about specific pods
  containers.podman.podman_pod_info:
    name: special_pod

返回值

常见的返回值记录在此处,以下是此模块特有的字段

描述

pods

列表 / 元素=字符串

来自所有或指定 pod 的事实

返回: 总是

示例: [{"CgroupParent": "user.slice", "CgroupPath": "user.slice/user-1000.slice/[email protected]/user.slice/....slice", "Containers": [{"Id": "37f960e6c8accc6b5b41945b1dcf03a28d3a366f7f37049748f18b21c44f577e", "Name": "a99a49b8fa77-infra", "State": "created"}], "CreateCgroup": true, "CreateCommand": ["podman", "pod", "create", "--name", "pod_name", "--infra=True", "--userns", "auto", "--security-opt", "seccomp=unconfined", "--security-opt", "apparmor=unconfined", "--hostname", "mypod", "--dns", "1.1.1.2", "--label", "key=cval", "--label", "otherkey=kddkdk", "--label", "somekey=someval", "--add-host", "google:5.5.5.5", "--volume", "/tmp/test//:/data2"], "CreateInfra": true, "Created": "2024-05-28T20:41:09.946926613+03:00", "ExitPolicy": "continue", "Hostname": "mypod", "Id": "a99a41b8fa77d8c7ff1c432a7a21bc0c2afd8c13b94a9d9b9b19b66ae97920c1", "InfraConfig": {"DNSOption": null, "DNSSearch": null, "DNSServer": ["1.1.1.2"], "HostAdd": ["google:5.5.5.5"], "HostNetwork": false, "NetworkOptions": null, "Networks": null, "NoManageHosts": false, "NoManageResolvConf": false, "PortBindings": {}, "StaticIP": "", "StaticMAC": "", "pid_ns": "private", "userns": "host", "uts_ns": "private"}, "InfraContainerID": "37f960e6c8accc6b5b41945b1dcf03a28d3a366f7f37049748f18b21c44f577e", "Labels": {"key": "cval", "otherkey": "kddkdk", "somekey": "someval"}, "LockNumber": 1, "Name": "pod_name", "NumContainers": 1, "SharedNamespaces": ["user", "uts", "ipc", "net"], "State": "Created", "mounts": [{"Destination": "/data2", "Driver": "", "Mode": "", "Options": ["nosuid", "nodev", "rbind"], "Propagation": "rprivate", "RW": true, "Source": "/tmp/test", "Type": "bind"}], "security_opt": ["seccomp=unconfined", "apparmor=unconfined"]}]

作者

  • Sagi Shnaidman (@sshnaidm)