containers.podman.podman_network module – Manage podman networks
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_network
.
New in containers.podman 1.0.0
Synopsis
Manage podman networks with podman network command.
Requirements
The below requirements are needed on the host that executes this module.
podman
Parameters
Parameter |
Comments |
---|---|
Return additional information which can be helpful for investigations. Choices:
|
|
disable dns plugin (default “false”) Choices:
|
|
Set network-scoped DNS resolver/nameserver for containers in this network. If not set, the host servers from /etc/resolv.conf is used. |
|
Driver to manage the network (default “bridge”) |
|
Path to Default: |
|
Remove all containers that use the network. If the container is running, it is stopped and removed. Choices:
|
|
IPv4 or IPv6 gateway for the subnet |
|
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’) |
|
Restrict external access from this network (default “false”) Choices:
|
|
Allocate container IP from range |
|
Set the ipam driver (IP Address Management Driver) for the network. When unset podman chooses an ipam driver automatically based on the network driver Choices:
|
|
Enable IPv6 (Dual Stack) networking. You must pass a IPv6 subnet. The subnet option must be used with the ipv6 option. Idempotency is not supported because it generates subnets randomly. Choices:
|
|
Create a Macvlan connection based on this device |
|
Name of the network |
|
List of dictionaries with network configuration. Each dictionary should contain ‘subnet’ and ‘gateway’ keys. ‘ip_range’ is optional. |
|
Gateway for the subnet |
|
Allocate container IP from range |
|
Subnet in CIDR format |
|
Add network options. Currently ‘vlan’ and ‘mtu’ are supported. |
|
Set the threshold for broadcast queueing. Must be a 32 bit integer. Setting this value to -1 disables broadcast queueing altogether. |
|
This option assigns the given name to the created Linux Bridge. Sets ‘com.docker.network.bridge.name’ option. |
|
Sets the Maximum Transmission Unit (MTU) and takes an integer value. Sets ‘com.docker.network.driver.mtu’ option. |
|
This option isolates networks by blocking traffic between those that have this option enabled. Choices:
|
|
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. |
|
This option sets the specified ip/macvlan mode on the interface. |
|
MTU size for bridge network interface. |
|
If set to 1, Podman will NOT automatically add a default route to subnets. |
|
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. |
|
VLAN tag for bridge which enables vlan_filtering. |
|
This option assigns a VRF to the bridge interface. It accepts the name of the VRF and defaults to none. Can only be used with the Netavark network backend. |
|
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. By default it takes name value. |
|
Options for the quadlet file. Provide missing in usual network args options as a list of lines to add. |
|
Recreate network even if exists. Choices:
|
|
A static route in the format <destination in CIDR notation>,<gateway>,<route metric (optional)>. This route will be added to every container in this network. |
|
State of network, default ‘present’ Choices:
|
|
Subnet in CIDR format |
Examples
- name: Create a podman network
containers.podman.podman_network:
name: podman_network
become: true
- 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
- name: Create Quadlet file for podman network
containers.podman.podman_network:
name: podman_network
state: quadlet
quadlet_options:
- IPv6=true
- Label="ipv6 network"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Facts from created or updated networks Returned: always Sample: |