mnecas.ovirt.ovirt_host_network (1.5.5) — module

Module to manage host networks in oVirt/RHV

| "added in version" 1.0.0 of mnecas.ovirt"

Authors: Ondra Machacek (@machacekondra), Martin Necas (@mnecas)

Install collection

Install with ansible-galaxy collection install mnecas.ovirt:==1.5.5


Add to requirements.yml

  collections:
    - name: mnecas.ovirt
      version: 1.5.5

Description

Module to manage host networks in oVirt/RHV.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Examples don't contain auth parameter for simplicity,
# look at ovirt_auth module to see how to reuse authentication:

# In all examples the durability of the configuration created is dependent on the 'save' option value:

# Create bond on eth0 and eth1 interface, and put 'myvlan' network on top of it and persist the new configuration:
- name: Bonds
  mnecas.ovirt.ovirt_host_network:
    name: myhost
    save: yes
    bond:
      name: bond0
      mode: 2
      interfaces:
        - eth1
        - eth2
    networks:
      - name: myvlan
        boot_protocol: static
        address: 1.2.3.4
        netmask: 255.255.255.0
        gateway: 1.2.3.4
        version: v4
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create bond on eth1 and eth2 interface, specifying both mode and miimon:
- name: Bonds
  mnecas.ovirt.ovirt_host_network:
    name: myhost
    bond:
      name: bond0
      mode: 1
      options:
        miimon: 200
      interfaces:
        - eth1
        - eth2
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Remove bond0 bond from host interfaces:
- mnecas.ovirt.ovirt_host_network:
    state: absent
    name: myhost
    bond:
      name: bond0
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Assign myvlan1 and myvlan2 vlans to host eth0 interface:
- mnecas.ovirt.ovirt_host_network:
    name: myhost
    interface: eth0
    networks:
      - name: myvlan1
      - name: myvlan2
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Remove myvlan2 vlan from host eth0 interface:
- mnecas.ovirt.ovirt_host_network:
    state: absent
    name: myhost
    interface: eth0
    networks:
      - name: myvlan2
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Remove all networks/vlans from host eth0 interface:
- mnecas.ovirt.ovirt_host_network:
    state: absent
    name: myhost
    interface: eth0
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Add custom_properties to network:
- mnecas.ovirt.ovirt_host_network:
    name: myhost
    interface: eth0
    networks:
      - name: myvlan1
        custom_properties:
          - name: bridge_opts
            value: gc_timer=10

Inputs

    
auth:
    description:
    - 'Dictionary with values needed to create HTTP/HTTPS connection to oVirt:'
    required: true
    suboptions:
      ca_file:
        description:
        - A PEM file containing the trusted CA certificates.
        - The certificate presented by the server will be verified using these CA certificates.
        - If C(ca_file) parameter is not set, system wide CA certificate store is used.
        - Default value is set by C(OVIRT_CAFILE) environment variable.
        type: str
      compress:
        default: true
        description: Flag indicating if compression is used for connection.
        type: bool
      headers:
        description:
        - Dictionary of HTTP headers to be added to each API call.
        type: dict
      hostname:
        description:
        - A string containing the hostname of the server, usually something like `I(server.example.com)`.
        - Default value is set by C(OVIRT_HOSTNAME) environment variable.
        - Either C(url) or C(hostname) is required.
        type: str
      insecure:
        default: false
        description:
        - A boolean flag that indicates if the server TLS certificate and host name should
          be checked.
        type: bool
      kerberos:
        description:
        - A boolean flag indicating if Kerberos authentication should be used instead
          of the default basic authentication.
        type: bool
      password:
        description:
        - The password of the user.
        - Default value is set by C(OVIRT_PASSWORD) environment variable.
        required: true
        type: str
      timeout:
        description: Number of seconds to wait for response.
        type: int
      token:
        description:
        - Token to be used instead of login with username/password.
        - Default value is set by C(OVIRT_TOKEN) environment variable.
        type: str
      url:
        description:
        - A string containing the API URL of the server, usually something like `I(https://server.example.com/ovirt-engine/api)`.
        - Default value is set by C(OVIRT_URL) environment variable.
        - Either C(url) or C(hostname) is required.
        type: str
      username:
        description:
        - The name of the user, something like I(admin@internal).
        - Default value is set by C(OVIRT_USERNAME) environment variable.
        required: true
        type: str
    type: dict

bond:
    description:
    - 'Dictionary describing network bond:'
    suboptions:
      interfaces:
        description:
        - List of interfaces to create a bond.
      mode:
        description:
        - Bonding mode.
      name:
        description:
        - Bond name.
      options:
        description:
        - Bonding options.
    type: dict

name:
    aliases:
    - host
    description:
    - Name of the host to manage networks for.
    required: true
    type: str

save:
    default: true
    description:
    - If I(true) network configuration will be persistent, otherwise it is temporary.
      Default I(true) since Ansible 2.8.
    type: bool

wait:
    default: true
    description:
    - C(yes) if the module should wait for the entity to get into desired state.
    type: bool

check:
    description:
    - If I(true) verify connectivity between host and engine.
    - Network configuration changes will be rolled back if connectivity between engine
      and the host is lost after changing network configuration.
    type: bool

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Should the host be present/absent.
    type: str

labels:
    description:
    - List of names of the network label to be assigned to bond or interface.
    elements: str
    type: list

timeout:
    default: 180
    description:
    - The amount of time in seconds the module should wait for the instance to get into
      desired state.
    type: int

networks:
    description:
    - 'List of dictionary describing networks to be attached to interface or bond:'
    elements: dict
    suboptions:
      address:
        description:
        - IP address in case of I(static) boot protocol is used.
      boot_protocol:
        choices:
        - none
        - static
        - dhcp
        description:
        - Boot protocol.
      custom_properties:
        description:
        - Custom properties applied to the host network.
        - Custom properties is a list of dictionary which can have following values.
        suboptions:
          name:
            description:
            - Name of custom property.
          value:
            description:
            - Value of custom property.
      gateway:
        description:
        - Gateway in case of I(static) boot protocol is used.
      name:
        description:
        - Name of the logical network to be assigned to bond or interface.
      netmask:
        description:
        - Subnet mask in case of I(static) boot protocol is used.
      version:
        description:
        - IP version. Either v4 or v6. Default is v4.
    type: list

interface:
    description:
    - Name of the network interface where logical network should be attached.
    type: str

fetch_nested:
    default: false
    description:
    - If I(True) the module will fetch additional data from the API.
    - It will fetch IDs of the VMs disks, snapshots, etc. User can configure to fetch
      other attributes of the nested entities by specifying C(nested_attributes).
    type: bool

poll_interval:
    default: 3
    description:
    - Number of the seconds the module waits until another poll request on entity status
      is sent.
    type: int

sync_networks:
    default: false
    description:
    - If I(true) all networks will be synchronized before modification
    type: bool

nested_attributes:
    description:
    - Specifies list of the attributes which should be fetched from the API.
    - This parameter apply only when C(fetch_nested) is I(true).
    elements: str
    type: list

Outputs

host_nic:
  description: 'Dictionary of all the host NIC attributes. Host NIC attributes can
    be found on your oVirt/RHV instance at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/host_nic.'
  returned: On success if host NIC is found.
  type: dict
id:
  description: ID of the host NIC which is managed
  returned: On success if host NIC is found.
  sample: 7de90f31-222c-436c-a1ca-7e655bd5b60c
  type: str