containers.podman.podman_play (1.12.1) — module

Play kubernetes YAML file using podman

Authors: Sagi Shnaidman (@sshnaidm)

Install collection

Install with ansible-galaxy collection install containers.podman:==1.12.1


Add to requirements.yml

  collections:
    - name: containers.podman
      version: 1.12.1

Description

The module reads in a structured file of Kubernetes YAML. It will then recreate the pod and containers described in the YAML.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Play kube file
  containers.podman.podman_play:
    kube_file: ~/kube.yaml
    state: started
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

Inputs

    
build:
    description:
    - Build images even if they are found in the local storage.
    - It is required to exist subdirectories matching the image names to be build.
    type: bool

debug:
    description:
    - Enable debug for the module.
    type: bool

quiet:
    description:
    - Hide image pulls logs from output.
    type: bool

state:
    choices:
    - created
    - started
    - absent
    description:
    - Start the pod after creating it, or to leave it created only.
    required: true
    type: str

userns:
    description:
    - 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.
    required: false
    type: str

log_opt:
    aliases:
    - log_options
    description:
    - Logging driver specific options. Set custom logging configuration.
    suboptions:
      max_size:
        description:
        - Specify a max size of the log file (e.g 10mb).
        required: false
        type: str
      path:
        description:
        - specify a path to the log file (e.g. /var/log/container/mycontainer.json).
        required: false
        type: str
      tag:
        description:
        - specify a custom log tag for the container. This option is currently supported
          only by the journald log driver in Podman.
        required: false
        type: str
    type: dict

network:
    description:
    - List of the names of CNI networks the pod should join.
    elements: str
    type: list

authfile:
    description:
    - 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
    type: path

cert_dir:
    description:
    - 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)
    type: path

password:
    description:
    - The username and password to use to authenticate with the registry if required.
    type: str

recreate:
    description:
    - If pod already exists, delete it and run the new one.
    type: bool

username:
    description:
    - The username and password to use to authenticate with the registry if required.
    type: str

configmap:
    description:
    - 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
    elements: path
    type: list

kube_file:
    description:
    - Path to file with YAML configuration for a Pod.
    required: true
    type: path

log_level:
    choices:
    - debug
    - info
    - warn
    - error
    - fatal
    - panic
    description:
    - Set logging level for podman calls. Log messages above specified level ("debug"|"info"|"warn"|"error"|"fatal"|"panic")
      (default "error")
    type: str

annotation:
    aliases:
    - annotations
    description:
    - Add an annotation to the container or pod.
    type: dict

executable:
    default: podman
    description:
    - Name of executable to run, by default 'podman'
    type: str

log_driver:
    description:
    - Set logging driver for all created containers.
    type: str

tls_verify:
    description:
    - 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.
    type: bool

context_dir:
    description:
    - Use path as the build context directory for each image. Requires build option be
      true.
    type: path

seccomp_profile_root:
    description:
    - Directory path for seccomp profiles (default is "/var/lib/kubelet/seccomp"). This
      option is not available with the remote Podman client
    type: path