|
|
|
@ -40,6 +40,11 @@ options:
|
|
|
|
|
required: true
|
|
|
|
|
description:
|
|
|
|
|
- Name of port to manage on the bridge
|
|
|
|
|
tag:
|
|
|
|
|
version_added: 2.2
|
|
|
|
|
required: false
|
|
|
|
|
description:
|
|
|
|
|
- VLAN tag for this port
|
|
|
|
|
state:
|
|
|
|
|
required: false
|
|
|
|
|
default: "present"
|
|
|
|
@ -73,6 +78,10 @@ EXAMPLES = '''
|
|
|
|
|
- openvswitch_port: bridge=bridge-loop port=eth6 state=present
|
|
|
|
|
set="Interface eth6 ofport_request=6"
|
|
|
|
|
|
|
|
|
|
# Creates port vlan10 with tag 10 on bridge br-ex
|
|
|
|
|
- openvswitch_port: bridge=br-ex port=vlan10 tag=10 state=present
|
|
|
|
|
set="Interface vlan10 type=internal"
|
|
|
|
|
|
|
|
|
|
# Assign interface id server1-vifeth6 and mac address 52:54:00:30:6d:11
|
|
|
|
|
# to port vifeth6 and setup port to be managed by a controller.
|
|
|
|
|
- openvswitch_port: bridge=br-int port=vifeth6 state=present
|
|
|
|
@ -118,6 +127,7 @@ class OVSPort(object):
|
|
|
|
|
self.module = module
|
|
|
|
|
self.bridge = module.params['bridge']
|
|
|
|
|
self.port = module.params['port']
|
|
|
|
|
self.tag = module.params['tag']
|
|
|
|
|
self.state = module.params['state']
|
|
|
|
|
self.timeout = module.params['timeout']
|
|
|
|
|
self.set_opt = module.params.get('set', None)
|
|
|
|
@ -167,6 +177,8 @@ class OVSPort(object):
|
|
|
|
|
def add(self):
|
|
|
|
|
'''Add the port'''
|
|
|
|
|
cmd = ['add-port', self.bridge, self.port]
|
|
|
|
|
if self.tag:
|
|
|
|
|
cmd += ["tag=" + self.tag]
|
|
|
|
|
if self.set and self.set_opt:
|
|
|
|
|
cmd += ["--", "set"]
|
|
|
|
|
cmd += self.set_opt.split(" ")
|
|
|
|
@ -235,6 +247,7 @@ def main():
|
|
|
|
|
argument_spec={
|
|
|
|
|
'bridge': {'required': True},
|
|
|
|
|
'port': {'required': True},
|
|
|
|
|
'tag': {'required': False},
|
|
|
|
|
'state': {'default': 'present', 'choices': ['present', 'absent']},
|
|
|
|
|
'timeout': {'default': 5, 'type': 'int'},
|
|
|
|
|
'set': {'required': False, 'default': None},
|
|
|
|
|