# containers.podman.podman_containers inventory – Inventory plugin that discovers Podman containers as hosts

Note

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

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_containers`.

New in containers.podman 1.18.0

## Synopsis

- Discover running (and optionally stopped) Podman containers on the local host and add them as inventory hosts.

- Each discovered host is assigned an Ansible connection plugin so tasks execute inside the container without SSH.

## Parameters

Parameter | Comments
--- | ---
connection_plugin string | Fully-qualified connection plugin to use for discovered hosts. Default: `"containers.podman.podman"`

executable

string

Path to the `podman` executable.

Default: `"podman"`

Configuration:

- Environment variable: `ANSIBLE_PODMAN_EXECUTABLE`

filters dictionary | Include/exclude selection by attributes - `name`, `id`, `image`, `status`, or `label.<key>`. Default: `{}`

group_by_image

boolean

Add containers to a group derived from image name (e.g., `image_node_14`).

Choices:

- `false`

- `true` ← (default)

group_by_label list / elements=string | Label keys to group containers by (`label_<key>_<value>`). Default: `[]`
groups dictionary | Add hosts to groups based on Jinja2 conditionals. Default: `{}`

include_stopped

boolean

Whether to include stopped/exited containers.

Choices:

- `false` ← (default)

- `true`

keyed_groups list / elements=dictionary | Create groups based on hostvars/labels. Default: `[]`
label_selectors dictionary | Key/value labels that must match (all) for a container to be included. Default: `{}`
name_patterns list / elements=string | Glob patterns to match container names or IDs; empty means include all. Default: `[]`

plugin

string / required

Token that ensures this is a source file for the ‘containers.podman.podman_containers’ inventory plugin.

Choices:

- `"containers.podman.podman_containers"`

strict

boolean

Fail when keyed/composed grouping references missing data.

Choices:

- `false` ← (default)

- `true`

verbose_output

boolean

When true, store raw `podman ps --format json` entry under `podman_ps` host var.

Choices:

- `false` ← (default)

- `true`

## Examples

    plugin: containers.podman.podman_containers
    include_stopped: false
    label_selectors:
      role: api
    connection_plugin: containers.podman.podman

### Authors

- Sagi Shnaidman (@sshnaidm)

### Collection links

- Issue Tracker
- Repository (Sources)