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

Note

This plugin is part of the containers.podman collection (version 1.8.1).

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.

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 Choices/Defaults Comments
executable
string
Default:
"podman"
Path to podman executable if it is not in the $PATH on the machine running 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 Returned Description
containers
list / elements=dictionary
always
Facts from all or specificed containers

Sample:
[{'AppArmorProfile': '', 'Args': ['--single-child', '--', 'kolla_start'], 'BoundingCaps': ['CAP_CHOWN', 'CAP_DAC_OVERRIDE', 'CAP_FSETID', 'CAP_FOWNER', 'CAP_MKNOD', 'CAP_NET_RAW', 'CAP_SETGID', 'CAP_SETUID', 'CAP_SETFCAP', 'CAP_SETPCAP', 'CAP_NET_BIND_SERVICE', 'CAP_SYS_CHROOT', 'CAP_KILL', 'CAP_AUDIT_WRITE'], 'Config': {'Annotations': {'io.kubernetes.cri-o.ContainerType': 'sandbox', 'io.kubernetes.cri-o.TTY': 'false', 'io.podman.annotations.autoremove': 'FALSE', 'io.podman.annotations.init': 'FALSE', 'io.podman.annotations.privileged': 'FALSE', 'io.podman.annotations.publish-all': 'FALSE'}, 'AttachStderr': False, 'AttachStdin': False, 'AttachStdout': False, 'Cmd': ['kolla_start'], 'Domainname': '', 'Entrypoint': 'dumb-init --single-child --', 'Env': ['PATH=/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'TERM=xterm', 'HOSTNAME=', 'container=oci', 'KOLLA_INSTALL_METATYPE=rdo', 'KOLLA_BASE_DISTRO=centos', 'KOLLA_INSTALL_TYPE=binary', 'KOLLA_DISTRO_PYTHON_VERSION=2.7', 'KOLLA_BASE_ARCH=x86_64'], 'Hostname': 'c5c39e813703', 'Image': 'docker.io/tripleomaster/centos-haproxy:latest', 'Labels': {'build-date': '20190919', 'kolla_version': '8.1.0', 'name': 'haproxy', 'org.label-schema.build-date': '20190801', 'org.label-schema.license': 'GPLv2', 'org.label-schema.name': 'CentOS Base Image', 'org.label-schema.schema-version': '1.0', 'org.label-schema.vendor': 'CentOS'}, 'OnBuild': None, 'OpenStdin': False, 'StdinOnce': False, 'StopSignal': 15, 'Tty': False, 'User': '', 'Volumes': None, 'WorkingDir': '/'}, 'Created': '2019-10-01T12:51:00.233106443Z', 'Dependencies': [], 'Driver': 'overlay', 'EffectiveCaps': ['CAP_CHOWN', 'CAP_DAC_OVERRIDE', 'CAP_FSETID', 'CAP_FOWNER', 'CAP_MKNOD', 'CAP_NET_RAW', 'CAP_SETGID', 'CAP_SETUID', 'CAP_SETFCAP', 'CAP_SETPCAP', 'CAP_NET_BIND_SERVICE', 'CAP_SYS_CHROOT', 'CAP_KILL', 'CAP_AUDIT_WRITE'], 'ExecIDs': [], 'ExitCommand': ['/usr/bin/podman', '--root', '/var/lib/containers/storage', '--runroot', '/var/run/containers/storage', '--log-level', 'error', '--cgroup-manager', 'systemd', '--tmpdir', '/var/run/libpod', '--runtime', 'runc', '--storage-driver', 'overlay', '--events-backend', 'journald', 'container', 'cleanup', 'c9e813703f9b80a6ea2ad665aa9946435934e478a0c5322da835f3883872f'], 'GraphDriver': {'Name': 'overlay'}, 'HostConfig': {'AutoRemove': False, 'Binds': [], 'BlkioDeviceReadBps': None, 'BlkioDeviceReadIOps': None, 'BlkioDeviceWriteBps': None, 'BlkioDeviceWriteIOps': None, 'BlkioWeight': 0, 'BlkioWeightDevice': None, 'CapAdd': [], 'CapDrop': [], 'Cgroup': '', 'CgroupParent': '', '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': '', 'Isolation': '', 'KernelMemory': 0, 'Links': None, 'LogConfig': {'Config': None, 'Type': 'k8s-file'}, 'Memory': 0, 'MemoryReservation': 0, 'MemorySwap': 0, 'MemorySwappiness': -1, 'NanoCpus': 0, 'NetworkMode': 'default', 'OomKillDisable': False, 'OomScoreAdj': 0, 'PidMode': '', 'PidsLimit': 0, 'PortBindings': {}, 'Privileged': False, 'PublishAllPorts': False, 'ReadonlyRootfs': False, 'RestartPolicy': {'MaximumRetryCount': 0, 'Name': ''}, 'Runtime': 'oci', 'SecurityOpt': [], 'ShmSize': 65536000, 'Tmpfs': {}, 'UTSMode': '', 'Ulimits': [{'Hard': 1048576, 'Name': 'RLIMIT_NOFILE', 'Soft': 1048576}, {'Hard': 1048576, 'Name': 'RLIMIT_NPROC', 'Soft': 1048576}], 'UsernsMode': '', 'VolumeDriver': '', 'VolumesFrom': None}, 'HostnamePath': '', 'HostsPath': '', 'Id': 'c5c39f9b80a6ea2ad665aa9946435934e478a0c5322da835f3883872f', 'Image': '0e267acda67d0ebd643e900d820a91b961d859743039e620191ca1', 'ImageName': 'docker.io/tripleomaster/centos-haproxy:latest', 'IsInfra': False, 'MountLabel': 'system_u:object_r:svirt_sandbox_file_t:s0:c78,c866', 'Mounts': [], 'Name': 'haproxy', 'Namespace': '', 'NetworkSettings': {'Bridge': '', 'EndpointID': '', 'Gateway': '', 'GlobalIPv6Address': '', 'GlobalIPv6PrefixLen': 0, 'HairpinMode': False, 'IPAddress': '', 'IPPrefixLen': 0, 'IPv6Gateway': '', 'LinkLocalIPv6Address': '', 'LinkLocalIPv6PrefixLen': 0, 'MacAddress': '', 'Ports': [], 'SandboxID': '', 'SandboxKey': '', 'SecondaryIPAddresses': None, 'SecondaryIPv6Addresses': None}, 'OCIRuntime': 'runc', 'Path': 'dumb-init', 'Pod': '', 'ProcessLabel': 'system_u:system_r:svirt_lxc_net_t:s0:c785,c866', 'ResolvConfPath': '', 'RestartCount': 0, 'Rootfs': '', 'State': {'Dead': False, 'Error': '', 'ExitCode': 0, 'FinishedAt': '0001-01-01T00:00:00Z', 'Healthcheck': {'FailingStreak': 0, 'Log': None, 'Status': ''}, 'OOMKilled': False, 'OciVersion': '1.0.1-dev', 'Paused': False, 'Pid': 0, 'Restarting': False, 'Running': False, 'StartedAt': '0001-01-01T00:00:00Z', 'Status': 'configured'}}]


Authors

  • Sagi Shnaidman (@sshnaidm)
  • Emilien Macchi (@EmilienM)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/containers/podman/podman_container_info_module.html