containers.podman.podman_pod (1.12.1) — module

Manage Podman pods

| "added in version" 1.0.0 of containers.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

Manage podman pods.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# What modules does for example
- podman_pod:
    name: pod1
    state: started
    ports:
      - "4444:5555"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Connect random port from localhost to port 80 on pod2
- name: Connect random port from localhost to port 80 on pod2
  containers.podman.podman_pod:
    name: pod2
    state: started
    publish: "127.0.0.1::80"

Inputs

    
ip:
    description:
    - Set a static IP for the pod's shared network.
    required: false
    type: str

dns:
    description:
    - Set custom DNS servers in the /etc/resolv.conf file that will be shared between
      all containers in the pod. A special option, "none" is allowed which disables creation
      of /etc/resolv.conf for the pod.
    elements: str
    required: false
    type: list

pid:
    description:
    - Set the PID mode for the pod. The default is to create a private PID namespace for
      the pod. Requires the PID namespace to be shared via `share` option.
    required: false
    type: str

cpus:
    description:
    - Set the total number of CPUs delegated to the pod. Default is 0.000 which indicates
      that there is no limit on computation power.
    required: false
    type: str

name:
    description:
    - Assign a name to the pod.
    required: true
    type: str

debug:
    default: false
    description:
    - Return additional information which can be helpful for investigations.
    type: bool

infra:
    description:
    - Create an infra container and associate it with the pod. An infra container is a
      lightweight container used to coordinate the shared kernel namespace of a pod. Default
      is true.
    required: false
    type: bool

label:
    description:
    - Add metadata to a pod, pass dictionary of label keys and values.
    required: false
    type: dict

share:
    description:
    - A comma delimited list of kernel namespaces to share. If none or "" is specified,
      no namespaces will be shared. The namespaces to choose from are ipc, net, pid, user,
      uts.
    required: false
    type: str

state:
    choices:
    - created
    - killed
    - restarted
    - absent
    - started
    - stopped
    - paused
    - unpaused
    default: created
    description:
    - This variable is set for state
    type: str

device:
    description:
    - Add a host device to the pod. Optional permissions parameter can be used to specify
      device permissions. It is a combination of r for read, w for write, and m for mknod(2)
    elements: str
    required: false
    type: list

gidmap:
    description:
    - GID map for the user namespace. Using this flag will run the container with user
      namespace enabled. It conflicts with the `userns` and `subgidname` flags.
    elements: str
    required: false
    type: list

memory:
    description:
    - Set memory limit.
    - A unit can be b (bytes), k (kibibytes), m (mebibytes), or g (gibibytes).
    required: false
    type: str

uidmap:
    description:
    - Run the container in a new user namespace using the supplied mapping. This option
      conflicts with the `userns` and `subuidname` options. This option provides a way
      to map host UIDs to container UIDs. It can be passed several times to map different
      ranges.
    elements: str
    required: false
    type: list

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

volume:
    aliases:
    - volumes
    description:
    - Create a bind mount.
    elements: str
    required: false
    type: list

dns_opt:
    description:
    - Set custom DNS options in the /etc/resolv.conf file that will be shared between
      all containers in the pod.
    elements: str
    required: false
    type: list

network:
    description:
    - Set network mode for the pod. Supported values are bridge (the default), host (do
      not create a network namespace, all containers in the pod will use the host's network),
      or a list of names of CNI networks to join.
    elements: str
    required: false
    type: list

publish:
    aliases:
    - ports
    description:
    - Publish a port or range of ports from the pod to the host.
    elements: str
    required: false
    type: list

add_host:
    description:
    - Add a host to the /etc/hosts file shared between all containers in the pod.
    elements: str
    required: false
    type: list

hostname:
    description:
    - Set a hostname to the pod
    required: false
    type: str

no_hosts:
    description:
    - Disable creation of /etc/hosts for the pod.
    required: false
    type: bool

recreate:
    default: false
    description:
    - Use with present and started states to force the re-creation of an existing pod.
    type: bool

cpu_shares:
    description:
    - CPU shares (relative weight).
    required: false
    type: str

dns_search:
    description:
    - Set custom DNS search domains in the /etc/resolv.conf file that will be shared between
      all containers in the pod.
    elements: str
    required: false
    type: list

executable:
    default: podman
    description:
    - Path to C(podman) executable if it is not in the C($PATH) on the machine running
      C(podman)
    type: str

infra_name:
    description:
    - The name that will be used for the pod's infra container.
    required: false
    type: str

label_file:
    description:
    - Read in a line delimited file of labels.
    required: false
    type: str

subgidname:
    description:
    - Name for GID map from the /etc/subgid file. Using this flag will run the container
      with user namespace enabled. This flag conflicts with `userns` and `gidmap`.
    required: false
    type: str

subuidname:
    description:
    - Name for UID map from the /etc/subuid file. Using this flag will run the container
      with user namespace enabled. This flag conflicts with `userns` and `uidmap`.
    required: false
    type: str

cpuset_cpus:
    description:
    - Limit the CPUs to support execution. First CPU is numbered 0. Unlike `cpus` this
      is of type string and parsed as a list of numbers. Format is 0-3,0,1
    required: false
    type: str

cpuset_mems:
    description:
    - Memory nodes in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
    required: false
    type: str

infra_image:
    description:
    - The image that will be created for the infra container. Default is "k8s.gcr.io/pause:3.1".
    required: false
    type: str

mac_address:
    description:
    - Set a static MAC address for the pod's shared network.
    required: false
    type: str

memory_swap:
    description:
    - Set limit value equal to memory plus swap.
    - A unit can be b (bytes), k (kibibytes), m (mebibytes), or g (gibibytes).
    required: false
    type: str

pod_id_file:
    description:
    - Write the pod ID to the file.
    required: false
    type: str

blkio_weight:
    description:
    - Block IO relative weight. The weight is a value between 10 and 1000.
    - This option is not supported on cgroups V1 rootless systems.
    required: false
    type: str

cgroup_parent:
    description:
    - Path to cgroups under which the cgroup for the pod will be created. If the path
      is not absolute, he path is considered to be relative to the cgroups path of the
      init process. Cgroups will be created if they do not already exist.
    required: false
    type: str

infra_command:
    description:
    - The command that will be run to start the infra container. Default is "/pause".
    required: false
    type: str

network_alias:
    aliases:
    - network_aliases
    description:
    - Add a network-scoped alias for the pod, setting the alias for all networks that
      the pod joins. To set a name only for a specific network, use the alias option as
      described under the -`network` option. Network aliases work only with the bridge
      networking mode. This option can be specified multiple times.
    elements: str
    required: false
    type: list

device_read_bps:
    description:
    - Limit read rate (bytes per second) from a device (e.g. device-read-bps=/dev/sda:1mb)
    elements: str
    required: false
    type: list

device_write_bps:
    description:
    - Limit write rate (in bytes per second) to a device.
    elements: str
    required: false
    type: list

generate_systemd:
    default: {}
    description:
    - Generate systemd unit file for container.
    suboptions:
      after:
        description:
        - Add the systemd unit after (After=) option, that ordering dependencies between
          the list of dependencies and this service.
        elements: str
        required: false
        type: list
      container_prefix:
        description:
        - Set the systemd unit name prefix for containers. The default is "container".
        required: false
        type: str
      names:
        default: true
        description:
        - Use names of the containers for the start, stop, and description in the unit
          file. Default is true.
        type: bool
      new:
        default: false
        description:
        - Create containers and pods when the unit is started instead of expecting them
          to exist. The default is "false". Refer to podman-generate-systemd(1) for more
          information.
        type: bool
      no_header:
        default: false
        description:
        - Do not generate the header including meta data such as the Podman version and
          the timestamp. From podman version 3.1.0.
        type: bool
      path:
        description:
        - Specify a path to the directory where unit files will be generated. Required
          for this option. If it doesn't exist, the directory will be created.
        required: false
        type: str
      pod_prefix:
        description:
        - Set the systemd unit name prefix for pods. The default is "pod".
        required: false
        type: str
      requires:
        description:
        - Set the systemd unit requires (Requires=) option. Similar to wants, but declares
          a stronger requirement dependency.
        elements: str
        required: false
        type: list
      restart_policy:
        choices:
        - 'no'
        - on-success
        - on-failure
        - on-abnormal
        - on-watchdog
        - on-abort
        - always
        description:
        - Specify a restart policy for the service.  The restart-policy must be one of
          "no", "on-success", "on-failure", "on-abnormal", "on-watchdog", "on-abort",
          or "always". The default policy is "on-failure".
        required: false
        type: str
      restart_sec:
        description: Set the systemd service restartsec value.
        required: false
        type: int
      separator:
        description:
        - Set the systemd unit name separator between the name/id of a container/pod and
          the prefix. The default is "-" (dash).
        required: false
        type: str
      start_timeout:
        description: Override the default start timeout for the container with the given
          value.
        required: false
        type: int
      stop_timeout:
        aliases:
        - time
        description:
        - Override the default stop timeout for the container with the given value. Called
          `time` before version 4.
        required: false
        type: int
      wants:
        description:
        - Add the systemd unit wants (Wants=) option, that this service is (weak) dependent
          on.
        elements: str
        required: false
        type: list
    type: dict

blkio_weight_device:
    description:
    - Block IO relative device weight.
    elements: str
    required: false
    type: list

infra_conmon_pidfile:
    description:
    - Write the pid of the infra container's conmon process to a file. As conmon runs
      in a separate process than Podman, this is necessary when using systemd to manage
      Podman containers and pods.
    required: false
    type: str

Outputs

pod:
  description: Pod inspection results for the given pod built.
  returned: always
  sample:
    Config:
      cgroupParent: /libpod_parent
      created: '2020-06-14T15:16:12.230818767+03:00'
      hostname: newpod
      id: a5a5c6cdf8c72272fc5c33f787e8d7501e2fa0c1e92b2b602860defdafeeec58
      infraConfig:
        infraPortBindings: null
        makeInfraContainer: true
      labels: {}
      lockID: 515
      name: newpod
      sharesCgroup: true
      sharesIpc: true
      sharesNet: true
      sharesUts: true
    Containers:
    - id: dc70a947c7ae15198ec38b3c817587584085dee3919cbeb9969e3ab77ba10fd2
      state: configured
    State:
      cgroupPath: /libpod_parent/a5a5c6cdf8c72272fc5c33f787e8d7501e2fa0c1e92b2b602860defdafeeec58
      infraContainerID: dc70a947c7ae15198ec38b3c817587584085dee3919cbeb9969e3ab77ba10fd2
      status: Created
  type: dict