mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-02-04 07:11:49 +00:00
Add IPv6 to network
Fix CI for podman network. Make 'subnet' required for ip-range or gateway. Add IPv6 subnets.
This commit is contained in:
parent
2a84642c3f
commit
04c7e18bc3
2 changed files with 20 additions and 2 deletions
|
|
@ -49,6 +49,11 @@ options:
|
|||
description:
|
||||
- Allocate container IP from range
|
||||
type: str
|
||||
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
|
||||
subnet:
|
||||
description:
|
||||
- Subnet in CIDR format
|
||||
|
|
@ -140,7 +145,6 @@ network:
|
|||
]
|
||||
"""
|
||||
|
||||
# noqa: F402
|
||||
import json # noqa: F402
|
||||
from distutils.version import LooseVersion # noqa: F402
|
||||
import os # noqa: F402
|
||||
|
|
@ -218,6 +222,9 @@ class PodmanNetworkModuleParams:
|
|||
def addparam_ip_range(self, c):
|
||||
return c + ['--ip-range', self.params['ip_range']]
|
||||
|
||||
def addparam_ipv6(self, c):
|
||||
return c + ['--ipv6']
|
||||
|
||||
def addparam_macvlan(self, c):
|
||||
return c + ['--macvlan', self.params['macvlan']]
|
||||
|
||||
|
|
@ -548,14 +555,16 @@ def main():
|
|||
gateway=dict(type='str', required=False),
|
||||
internal=dict(type='bool', required=False),
|
||||
ip_range=dict(type='str', required=False),
|
||||
ipv6=dict(type='bool', required=False),
|
||||
subnet=dict(type='str', required=False),
|
||||
macvlan=dict(type='str', required=False),
|
||||
executable=dict(type='str', required=False, default='podman'),
|
||||
debug=dict(type='bool', default=False),
|
||||
recreate=dict(type='bool', default=False),
|
||||
),
|
||||
required_by=dict( # for IP range to set 'subnet' is required
|
||||
required_by=dict( # for IP range and GW to set 'subnet' is required
|
||||
ip_range=('subnet'),
|
||||
gateway=('subnet'),
|
||||
))
|
||||
|
||||
PodmanNetworkManager(module).execute()
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@
|
|||
name: "{{ network_name }}"
|
||||
state: present
|
||||
gateway: 10.100.100.100
|
||||
subnet: 10.100.100.0/24
|
||||
register: info6
|
||||
|
||||
- name: Check info
|
||||
|
|
@ -126,6 +127,7 @@
|
|||
name: "{{ network_name }}"
|
||||
state: present
|
||||
gateway: 10.100.100.100
|
||||
subnet: 10.100.100.0/24
|
||||
register: info7
|
||||
|
||||
- name: Check info
|
||||
|
|
@ -192,6 +194,13 @@
|
|||
that:
|
||||
- info13 is not changed
|
||||
|
||||
- name: Create network with ipv6 subnet
|
||||
containers.podman.podman_network:
|
||||
name: "{{ network_name }}"
|
||||
state: present
|
||||
subnet: 2001:cafe::/64
|
||||
ipv6: true
|
||||
|
||||
- name: Make sure network doesn't exist
|
||||
containers.podman.podman_network:
|
||||
name: "{{ network_name }}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue