containers.podman.podman_play module – Play kubernetes YAML file 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_play
.
Synopsis
The module reads in a structured file of Kubernetes YAML. It will then recreate the pod and containers described in the YAML.
Requirements
The below requirements are needed on the host that executes this module.
Podman installed on host
Parameters
Parameter |
Comments |
---|---|
Add an annotation to the container or pod. |
|
Path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json, which is set using podman login. If the authorization state is not found there, $HOME/.docker/config.json is checked, which is set using docker login. Note - You can also override the default path of the authentication file by setting the REGISTRY_AUTH_FILE environment variable. export REGISTRY_AUTH_FILE=path |
|
Build images even if they are found in the local storage. It is required to exist subdirectories matching the image names to be build. Choices:
|
|
Use certificates at path (*.crt, *.cert, *.key) to connect to the registry. Default certificates directory is /etc/containers/certs.d. (This option is not available with the remote Podman client) |
|
Use Kubernetes configmap YAML at path to provide a source for environment variable values within the containers of the pod. Note - The configmap option can be used multiple times to pass multiple Kubernetes configmap YAMLs |
|
Use path as the build context directory for each image. Requires build option be true. |
|
Enable debug for the module. Choices:
|
|
Name of executable to run, by default ‘podman’ Default: |
|
Path to file with YAML configuration for a Pod. |
|
Content of the kube file. |
|
Set logging driver for all created containers. |
|
Set logging level for podman calls. Log messages above specified level (“debug”|”info”|”warn”|”error”|”fatal”|”panic”) (default “error”) Choices:
|
|
Logging driver specific options. Set custom logging configuration. |
|
Specify a max size of the log file (e.g 10mb). |
|
specify a path to the log file (e.g. /var/log/container/mycontainer.json). |
|
Specify a custom log tag for the container. This option is currently supported only by the journald log driver in Podman. |
|
List of the names of CNI networks the pod should join. |
|
The username and password to use to authenticate with the registry if required. |
|
Path to the directory to write quadlet file in. By default, it will be set as |
|
The permissions of the quadlet file. The If If Specifying |
|
Name of quadlet file to write. Must be specified if state is quadlet. |
|
Options for the quadlet file. Provide missing in usual network args options as a list of lines to add. |
|
Hide image pulls logs from output. Choices:
|
|
If pod already exists, delete it and run the new one. Choices:
|
|
Directory path for seccomp profiles (default is “/var/lib/kubelet/seccomp”). This option is not available with the remote Podman client |
|
Start the pod after creating it, or to leave it created only. Choices:
|
|
Require HTTPS and verify certificates when contacting registries (default is true). If explicitly set to true, then TLS verification will be used. If set to false, then TLS verification will not be used. If not specified, TLS verification will be used unless the target registry is listed as an insecure registry in registries.conf. Choices:
|
|
The username and password to use to authenticate with the registry if required. |
|
Set the user namespace mode for all the containers in a pod. It defaults to the PODMAN_USERNS environment variable. An empty value (“”) means user namespaces are disabled. |
Examples
- name: Play kube file
containers.podman.podman_play:
kube_file: ~/kube.yaml
state: started
- name: Recreate pod from a kube file with options
containers.podman.podman_play:
kube_file: ~/kube.yaml
state: started
recreate: true
annotations:
greeting: hello
greet_to: world
userns: host
log_opt:
path: /tmp/my-container.log
max_size: 10mb
- name: Create a Quadlet file
containers.podman.podman_play:
kube_file: ~/kube.yaml
state: quadlet
annotations:
greeting: hello
greet_to: world
userns: host
quadlet_filename: kube-pod
quadlet_file_mode: '0640'
quadlet_options:
- "SetWorkingDirectory=yaml"
- "ExitCodePropagation=any"