Skip to content

Commit

Permalink
Add support for setting underlying interface in podman_network (#677)
Browse files Browse the repository at this point in the history
It may be desirable to set a different interface than the default one
(for example, a different bridge).

In the case of a macvlan interface, it can be used instead of setting
`opt.parent`.

Signed-off-by: Pablo Méndez Hernández <[email protected]>
  • Loading branch information
pablomh authored Nov 29, 2023
1 parent b693cb6 commit ea51855
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion plugins/modules/podman_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
description:
- IPv4 or IPv6 gateway for the subnet
type: str
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
internal:
description:
- Restrict external access from this network (default "false")
Expand Down Expand Up @@ -98,7 +104,8 @@
required: false
parent:
description:
- The host device which should be used for the macvlan interface.
- 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.
type: str
required: false
Expand Down Expand Up @@ -277,6 +284,9 @@ def addparam_ipv6(self, c):
def addparam_macvlan(self, c):
return c + ['--macvlan', self.params['macvlan']]

def addparam_interface_name(self, c):
return c + ['--interface-name', self.params['interface_name']]

def addparam_internal(self, c):
return c + ['--internal=%s' % self.params['internal']]

Expand Down Expand Up @@ -657,6 +667,7 @@ def main():
driver=dict(type='str', required=False),
force=dict(type='bool', default=False),
gateway=dict(type='str', required=False),
interface_name=dict(type='str', required=False),
internal=dict(type='bool', required=False),
ip_range=dict(type='str', required=False),
ipv6=dict(type='bool', required=False),
Expand Down

0 comments on commit ea51855

Please sign in to comment.