.. _openvswitch.openvswitch.openvswitch_port_module:


****************************************
openvswitch.openvswitch.openvswitch_port
****************************************

**Manage Open vSwitch ports**


Version added: 1.0.0

.. contents::
   :local:
   :depth: 1


Synopsis
--------
- Manage Open vSwitch ports



Requirements
------------
The below requirements are needed on the host that executes this module.

- ovs-vsctl


Parameters
----------

.. raw:: html

    <table  border=0 cellpadding=0 class="documentation-table">
        <tr>
            <th colspan="1">Parameter</th>
            <th>Choices/<font color="blue">Defaults</font></th>
            <th width="100%">Comments</th>
        </tr>
            <tr>
                <td colspan="1">
                    <div class="ansibleOptionAnchor" id="parameter-"></div>
                    <b>bridge</b>
                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
                    <div style="font-size: small">
                        <span style="color: purple">string</span>
                         / <span style="color: red">required</span>
                    </div>
                </td>
                <td>
                </td>
                <td>
                        <div>Name of bridge to manage</div>
                </td>
            </tr>
            <tr>
                <td colspan="1">
                    <div class="ansibleOptionAnchor" id="parameter-"></div>
                    <b>database_socket</b>
                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
                    <div style="font-size: small">
                        <span style="color: purple">string</span>
                    </div>
                </td>
                <td>
                </td>
                <td>
                        <div>Path/ip to datbase socket to use</div>
                        <div>Default path is used if not specified</div>
                        <div>Path should start with &#x27;unix:&#x27; prefix</div>
                </td>
            </tr>
            <tr>
                <td colspan="1">
                    <div class="ansibleOptionAnchor" id="parameter-"></div>
                    <b>external_ids</b>
                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
                    <div style="font-size: small">
                        <span style="color: purple">dictionary</span>
                    </div>
                </td>
                <td>
                        <b>Default:</b><br/><div style="color: blue">{}</div>
                </td>
                <td>
                        <div>Dictionary of external_ids applied to a port.</div>
                </td>
            </tr>
            <tr>
                <td colspan="1">
                    <div class="ansibleOptionAnchor" id="parameter-"></div>
                    <b>port</b>
                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
                    <div style="font-size: small">
                        <span style="color: purple">string</span>
                         / <span style="color: red">required</span>
                    </div>
                </td>
                <td>
                </td>
                <td>
                        <div>Name of port to manage on the bridge</div>
                </td>
            </tr>
            <tr>
                <td colspan="1">
                    <div class="ansibleOptionAnchor" id="parameter-"></div>
                    <b>set</b>
                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
                    <div style="font-size: small">
                        <span style="color: purple">list</span>
                         / <span style="color: purple">elements=string</span>
                    </div>
                </td>
                <td>
                </td>
                <td>
                        <div>Set multiple properties on a port.</div>
                </td>
            </tr>
            <tr>
                <td colspan="1">
                    <div class="ansibleOptionAnchor" id="parameter-"></div>
                    <b>state</b>
                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
                    <div style="font-size: small">
                        <span style="color: purple">string</span>
                    </div>
                </td>
                <td>
                        <ul style="margin: 0; padding: 0"><b>Choices:</b>
                                    <li><div style="color: blue"><b>present</b>&nbsp;&larr;</div></li>
                                    <li>absent</li>
                        </ul>
                </td>
                <td>
                        <div>Whether the port should exist</div>
                </td>
            </tr>
            <tr>
                <td colspan="1">
                    <div class="ansibleOptionAnchor" id="parameter-"></div>
                    <b>tag</b>
                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
                    <div style="font-size: small">
                        <span style="color: purple">string</span>
                    </div>
                </td>
                <td>
                </td>
                <td>
                        <div>VLAN tag for this port. Must be a value between 0 and 4095.</div>
                </td>
            </tr>
            <tr>
                <td colspan="1">
                    <div class="ansibleOptionAnchor" id="parameter-"></div>
                    <b>timeout</b>
                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
                    <div style="font-size: small">
                        <span style="color: purple">integer</span>
                    </div>
                </td>
                <td>
                        <b>Default:</b><br/><div style="color: blue">5</div>
                </td>
                <td>
                        <div>How long to wait for ovs-vswitchd to respond</div>
                </td>
            </tr>
    </table>
    <br/>




Examples
--------

.. code-block:: yaml

    # Creates port eth2 on bridge br-ex
    - openvswitch.openvswitch.openvswitch_port:
        bridge: br-ex
        port: eth2
        state: present

    # Creates port eth6
    - openvswitch.openvswitch.openvswitch_port:
        bridge: bridge-loop
        port: eth6
        state: present
        set: Interface eth6

    # Creates port vlan10 with tag 10 on bridge br-ex
    - openvswitch.openvswitch.openvswitch_port:
        bridge: br-ex
        port: vlan10
        tag: 10
        state: present
        set: Interface vlan10

    # Assign interface id server1-vifeth6 and mac address 00:00:5E:00:53:23
    # to port vifeth6 and setup port to be managed by a controller.
    - openvswitch.openvswitch.openvswitch_port:
        bridge: br-int
        port: vifeth6
        state: present
      args:
        external_ids:
          iface-id: '{{ inventory_hostname }}-vifeth6'
          attached-mac: 00:00:5E:00:53:23
          vm-id: '{{ inventory_hostname }}'
          iface-status: active

    # Plugs port veth0 into brdige br0 for database for OVSDB instance
    # with socket unix:/opt/second_ovsdb.sock
    - openvswitch.openvswitch.openvswitch_port:
        bridge: br0
        port: veth0
        state: present
        database_socket: unix:/opt/second_ovsdb.sock




Status
------


Authors
~~~~~~~

- David Stygstra (@stygstra)
