containers.podman.podman_container_copy module – Copy file to/from a container

Note

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

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_copy.

Synopsis

  • Copy file or folder from the host to a container and vice-versa.

Parameters

Parameter

Comments

archive

boolean

Chown copied files to the primary uid/gid of the destination container.

Choices:

  • false

  • true ← (default)

container

string / required

Name/ID of the container to copy from/to

dest

string / required

Path of the destination file/folder to copy from/to the container

executable

string

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

Default: "podman"

from_container

boolean

Specify whether or not the file must be copied from the container to the host

Choices:

  • false ← (default)

  • true

overwrite

boolean

Allow to overwrite directories with non-directories and vice versa

Choices:

  • false ← (default)

  • true

src

string / required

Path of the file/folder to copy from/to the container

Notes

Note

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

Examples

- name: Copy file "test.yml" on the host to the "apache" container's root folder
  containers.podman.podman_search:
    src: test.yml
    dest: /
    container: apache
- name: Copy file "test.yml" in the "apache" container's root folder to the playbook's folder
  containers.podman.podman_search:
    src: /test.yml
    dest: ./
    container: apache
    from_container: True

Authors

  • Alessandro Rossi (@kubealex)