containers.podman.podman_container_info module – Gather facts about containers using podman

Note

This module is part of the containers.podman collection (version 1.16.2).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install containers.podman. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: containers.podman.podman_container_info.

Synopsis

  • Gather facts about containers using podman

Requirements

The below requirements are needed on the host that executes this module.

  • Podman installed on host

Parameters

Parameter

Comments

executable

string

Path to podman executable if it is not in the $PATH on the machine running podman

Default: "podman"

name

list / elements=string

List of container names to gather facts about. If no name is given return facts about all containers.

Notes

Note

  • Podman may require elevated privileges in order to run properly.

Examples

- name: Gather facts for all containers
  containers.podman.podman_container_info:

- name: Gather facts on a specific container
  containers.podman.podman_container_info:
    name: web1

- name: Gather facts on several containers
  containers.podman.podman_container_info:
    name:
      - redis
      - web1

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

containers

list / elements=dictionary

Facts from all or specified containers

Returned: always

Sample: [{"AppArmorProfile": "", "Args": ["/entrypoint.sh"], "BoundingCaps": ["CAP_CHOWN", "CAP_DAC_OVERRIDE", "CAP_FOWNER", "CAP_FSETID", "CAP_KILL", "CAP_NET_BIND_SERVICE", "CAP_SETFCAP", "CAP_SETGID", "CAP_SETPCAP", "CAP_SETUID", "CAP_SYS_CHROOT"], "Config": {"Annotations": {"io.container.manager": "libpod", "org.opencontainers.image.stopSignal": "15"}, "AttachStderr": false, "AttachStdin": false, "AttachStdout": false, "Cmd": null, "CreateCommand": ["podman", "run", "-d", "--name", "test", "-p", "8888:80", "registry/org/image:latest"], "Domainname": "", "Entrypoint": "/entrypoint.sh", "Env": ["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "container=podman", "HOME=/root", "HOSTNAME=444a8274863a"], "HealthcheckOnFailureAction": "none", "Hostname": "444a8274863a", "Image": "registry/org/image:latest", "Labels": {"io.buildah.version": "1.31.2"}, "OnBuild": null, "OpenStdin": false, "Passwd": true, "StdinOnce": false, "StopSignal": 15, "StopTimeout": 10, "Timeout": 0, "Tty": false, "Umask": "0022", "User": "", "Volumes": null, "WorkingDir": "/", "sdNotifyMode": "container"}, "ConmonPidFile": "/run/user/1000/containers/overlay-containers/d38a.../userdata/conmon.pid", "Created": "2024-08-14T00:04:33.127266655+03:00", "Dependencies": [], "Driver": "overlay", "EffectiveCaps": ["CAP_CHOWN", "CAP_DAC_OVERRIDE", "CAP_FOWNER", "CAP_FSETID", "CAP_KILL", "CAP_NET_BIND_SERVICE", "CAP_SETFCAP", "CAP_SETGID", "CAP_SETPCAP", "CAP_SETUID", "CAP_SYS_CHROOT"], "ExecIDs": [], "GraphDriver": {"Data": {"LowerDir": "/home/podman/.local/share/containers/storage/overlay/29e2.../diff:...", "MergedDir": "/home/podman/.local/share/containers/storage/overlay/865909.../merged", "UpperDir": "/home/podman/.local/share/containers/storage/overlay/865909.../diff", "WorkDir": "/home/podman/.local/share/containers/storage/overlay/865909.../work"}, "Name": "overlay"}, "HostConfig": {"AutoRemove": false, "Binds": [], "BlkioDeviceReadBps": null, "BlkioDeviceReadIOps": null, "BlkioDeviceWriteBps": null, "BlkioDeviceWriteIOps": null, "BlkioWeight": 0, "BlkioWeightDevice": null, "CapAdd": [], "CapDrop": [], "Cgroup": "", "CgroupConf": null, "CgroupManager": "systemd", "CgroupMode": "private", "CgroupParent": "user.slice", "Cgroups": "default", "ConsoleSize": [0, 0], "ContainerIDFile": "", "CpuCount": 0, "CpuPercent": 0, "CpuPeriod": 0, "CpuQuota": 0, "CpuRealtimePeriod": 0, "CpuRealtimeRuntime": 0, "CpuShares": 0, "CpusetCpus": "", "CpusetMems": "", "Devices": [], "DiskQuota": 0, "Dns": [], "DnsOptions": [], "DnsSearch": [], "ExtraHosts": [], "GroupAdd": [], "IOMaximumBandwidth": 0, "IOMaximumIOps": 0, "IpcMode": "shareable", "Isolation": "", "KernelMemory": 0, "Links": null, "LogConfig": {"Config": null, "Path": "", "Size": "0B", "Tag": "", "Type": "journald"}, "Memory": 0, "MemoryReservation": 0, "MemorySwap": 0, "MemorySwappiness": 0, "NanoCpus": 0, "NetworkMode": "slirp4netns", "OomKillDisable": false, "OomScoreAdj": 0, "PidMode": "private", "PidsLimit": 2048, "PortBindings": {"80/tcp": [{"HostIp": "", "HostPort": "8888"}]}, "Privileged": false, "PublishAllPorts": false, "ReadonlyRootfs": false, "RestartPolicy": {"MaximumRetryCount": 0, "Name": ""}, "Runtime": "oci", "SecurityOpt": [], "ShmSize": 65536000, "Tmpfs": {}, "UTSMode": "private", "Ulimits": [{"Hard": 524288, "Name": "RLIMIT_NOFILE", "Soft": 524288}, {"Hard": 256018, "Name": "RLIMIT_NPROC", "Soft": 256018}], "UsernsMode": "", "VolumeDriver": "", "VolumesFrom": null}, "HostnamePath": "/run/user/1000/containers/overlay-containers/d38a.../userdata/hostname", "HostsPath": "/run/user/1000/containers/overlay-containers/d38a.../userdata/hosts", "Id": "d38a8fcd61ab7e0754355e8fb3acc201e07770f3d1fd8fed36556941ac458ce", "Image": "fe2ba3a8ede60e5938e666b483c3a812ba902dac2303341930fbadc0482592b7", "ImageDigest": "sha256:1222865ed7489298ee28414ddedb63a0c6405938c3a38adf21c8656d7f532271", "ImageName": "registry/org/image:latest", "IsInfra": false, "IsService": false, "KubeExitCodePropagation": "invalid", "MountLabel": "system_u:object_r:container_file_t:s0:c493,c986", "Mounts": [], "Name": "costapp", "Namespace": "", "NetworkSettings": {"Bridge": "", "EndpointID": "", "Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "HairpinMode": false, "IPAddress": "", "IPPrefixLen": 0, "IPv6Gateway": "", "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "MacAddress": "", "Ports": {"80/tcp": [{"HostIp": "", "HostPort": "8888"}]}, "SandboxID": "", "SandboxKey": "/run/user/1000/netns/netns-2343321-795a-8289-14c0-77ee2556ebf1"}, "OCIConfigPath": "/home/podman/.local/share/containers/....json", "OCIRuntime": "crun", "Path": "/entrypoint.sh", "PidFile": "/run/user/1000/containers/overlay-containers/d38a.../userdata/pidfile", "Pod": "", "ProcessLabel": "system_u:system_r:container_t:s0:c493,c986", "ResolvConfPath": "/run/user/1000/containers/overlay-containers/d38a.../userdata/resolv.conf", "RestartCount": 0, "Rootfs": "", "State": {"CgroupPath": "/user.slice/user-1000.slice/user@1000.service/user.slice/libpod-d38a....scope", "CheckpointedAt": "0001-01-01T00:00:00Z", "ConmonPid": 2434162, "Dead": false, "Error": "", "ExitCode": 0, "FinishedAt": "0001-01-01T00:00:00Z", "Health": {"FailingStreak": 0, "Log": null, "Status": ""}, "OOMKilled": false, "OciVersion": "1.1.0+dev", "Paused": false, "Pid": 2434164, "Restarting": false, "RestoredAt": "0001-01-01T00:00:00Z", "Running": true, "StartedAt": "2024-08-14T00:04:33.237286439+03:00", "Status": "running"}, "StaticDir": "/home/podman/.local/share/containers/storage/overlay-containers/d38a.../userdata", "lockNumber": 1417}]

Authors

  • Sagi Shnaidman (@podman)

  • Emilien Macchi (@EmilienM)