containers.podman.podman_network (1.12.1) — module

Manage podman networks

| "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 networks with podman network command.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a podman network
  containers.podman.podman_network:
    name: podman_network
  become: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create internal podman network
  containers.podman.podman_network:
    name: podman_internal
    internal: true
    ip_range: 192.168.22.128/25
    subnet: 192.168.22.0/24
    gateway: 192.168.22.1
  become: true

Inputs

    
opt:
    description:
    - Add network options. Currently 'vlan' and 'mtu' are supported.
    suboptions:
      isolate:
        description:
        - This option isolates networks by blocking traffic between those that have this
          option enabled.
        required: false
        type: bool
      metric:
        description:
        - Sets the Route Metric for the default route created in every container joined
          to this network. Can only be used with the Netavark network backend.
        required: false
        type: int
      mode:
        description:
        - This option sets the specified ip/macvlan mode on the interface.
        required: false
        type: str
      mtu:
        description:
        - MTU size for bridge network interface.
        required: false
        type: int
      parent:
        description:
        - The host device which should be used for the macvlan interface (it is the same
          as 'interface' in that case). Defaults to the default route interface.
        required: false
        type: str
      vlan:
        description:
        - VLAN tag for bridge which enables vlan_filtering.
        required: false
        type: int
    type: dict

ipv6:
    description:
    - Enable IPv6 (Dual Stack) networking. You must pass a IPv6 subnet. The subnet option
      must be used with the ipv6 option.
    type: bool

name:
    description:
    - Name of the network
    required: true
    type: str

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

force:
    default: false
    description:
    - Remove all containers that use the network. If the container is running, it is stopped
      and removed.
    type: bool

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of network, default 'present'
    type: str

driver:
    description:
    - Driver to manage the network (default "bridge")
    type: str

subnet:
    description:
    - Subnet in CIDR format
    type: str

gateway:
    description:
    - IPv4 or IPv6 gateway for the subnet
    type: str

macvlan:
    description:
    - Create a Macvlan connection based on this device
    type: str

internal:
    description:
    - Restrict external access from this network (default "false")
    type: bool

ip_range:
    description:
    - Allocate container IP from range
    type: str

recreate:
    default: false
    description:
    - Recreate network even if exists.
    type: bool

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

disable_dns:
    description:
    - disable dns plugin (default "false")
    type: bool

interface_name:
    description:
    - For bridge, it uses the bridge interface name. For macvlan, it is the parent device
      on the host (it is the same as 'opt.parent')
    type: str

Outputs

network:
  description: Facts from created or updated networks
  returned: always
  sample:
  - cniVersion: 0.4.0
    name: podman
    plugins:
    - bridge: cni-podman0
      ipMasq: true
      ipam:
        ranges:
        - - gateway: 10.88.0.1
            subnet: 10.88.0.0/16
        routes:
        - dst: 0.0.0.0/0
        type: host-local
      isGateway: true
      type: bridge
    - capabilities:
        portMappings: true
      type: portmap
    - backend: iptables
      type: firewall
  type: list