containers.podman.podman connection – Interact with an existing podman container

Note

This connection plugin is part of the containers.podman collection (version 1.19.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.

Synopsis

  • Run commands or put/fetch files to an existing container using podman tool.

  • Supports both direct execution and filesystem mounting for optimal performance.

Parameters

Parameter

Comments

container_timeout

integer

Timeout in seconds for container operations. 0 means no timeout.

Default: 0

Configuration:

  • INI entry:

    [defaults]
    podman_timeout = 0
    
  • Environment variable: ANSIBLE_PODMAN_TIMEOUT

  • Variable: ansible_podman_timeout

extra_env_vars

dictionary

Additional environment variables to set in the container.

Default: {}

Configuration:

  • Variable: ansible_podman_extra_env

ignore_mount_errors

boolean

Continue with copy operations even if container mounting fails.

Choices:

  • false

  • true ← (default)

Configuration:

  • Variable: ansible_podman_ignore_mount_errors

mount_detection

boolean

Enable automatic detection and use of container mount points for file operations.

Choices:

  • false

  • true ← (default)

Configuration:

podman_executable

string

Executable for podman command.

Default: "podman"

Configuration:

  • INI entry:

    [defaults]
    podman_executable = podman
    
  • Environment variable: ANSIBLE_PODMAN_EXECUTABLE

  • Variable: ansible_podman_executable

podman_extra_args

string

Extra arguments to pass to the podman command line.

Default: ""

Configuration:

  • INI entry:

    [defaults]
    podman_extra_args = ""
    
  • Environment variable: ANSIBLE_PODMAN_EXTRA_ARGS

  • Variable: ansible_podman_extra_args

privilege_escalation_method

string

Method to use for privilege escalation inside container.

Choices:

  • "auto" ← (default)

  • "sudo"

  • "su"

  • "none"

Configuration:

  • Variable: ansible_podman_privilege_escalation

remote_addr

string

The ID or name of the container you want to access.

Default: "inventory_hostname"

Configuration:

  • INI entry:

    [defaults]
    remote_addr = inventory_hostname
    
  • Environment variable: ANSIBLE_PODMAN_HOST

  • Variable: inventory_hostname

  • Variable: ansible_host

  • Variable: ansible_podman_host

remote_user

string

User specified via name or UID which is used to execute commands inside the container.

If you specify the user via UID, you must set ANSIBLE_REMOTE_TMP to a path that exists inside the container and is writable by Ansible.

Configuration:

  • INI entry:

    [defaults]
    remote_user = VALUE
    
  • Environment variable: ANSIBLE_REMOTE_USER

  • Variable: ansible_user

working_directory

string

Working directory for commands executed in the container.

Configuration:

  • Variable: ansible_podman_working_directory

Note

Configuration entries listed above for each entry type (Ansible variable, environment variable, and so on) have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. The entry types are also ordered by precedence from low to high priority order. For example, an ansible.cfg entry (further up in the list) is overwritten by an Ansible variable (further down in the list).

Authors

  • Tomas Tomecek (@TomasTomecek)