community.hrobot.v_switch (1.9.1) — module

Manage Hetzner's vSwitch

| "added in version" 1.7.0 of community.hrobot"

Authors: Alexander Gil Casas (@pando85)

Install collection

Install with ansible-galaxy collection install community.hrobot:==1.9.1


Add to requirements.yml

  collections:
    - name: community.hrobot
      version: 1.9.1

Description

Manage Hetzner's vSwitch.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create vSwitch with VLAN 4010 and name foo
  community.hrobot.v_switch:
    hetzner_user: foo
    hetzner_password: bar
    vlan: 4010
    name: foo
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create vSwitch with VLAN 4020 and name foo with two servers
  community.hrobot.v_switch:
    hetzner_user: foo
    hetzner_password: bar
    vlan: 4010
    name: foo
    servers:
      - 123.123.123.123
      - 154323

Inputs

    
name:
    description:
    - The vSwitch's name.
    - In order to identify a vSwitch both name and VLAN must match. If not, a new vSwitch
      will be created.
    required: true
    type: str

vlan:
    description:
    - The vSwitch's VLAN ID.
    - Range can be from 4000 to 4091.
    - In order to identify a vSwitch both name and VLAN must match. If not, a new vSwitch
      will be created.
    required: true
    type: int

wait:
    default: true
    description:
    - Whether to wait until the vSwitch has been successfully configured before determining
      what to do, and before returning from the module.
    - The API returns status C(in process) when the vSwitch is currently being set up
      in the servers. If this happens, the module will try again until the status changes
      to C(ready) or server has been removed from vSwitch.
    - Please note that if you disable wait while deleting and removing servers module
      will fail with C(VSWITCH_IN_PROCESS) error.
    type: bool

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of the vSwitch.
    - vSwitch is created if state is V(present), and deleted if state is V(absent).
    - V(absent) just cancels the vSwitch at the end of the current day.
    - When cancelling, you have to specify O(servers=[]) if you want to actively remove
      the servers in the vSwitch.
    type: str

servers:
    description:
    - List of server identifiers (server's numeric ID or server's main IPv4 or IPv6).
    - If servers is not specified, servers are not going to be deleted.
    elements: str
    type: list

timeout:
    default: 180
    description:
    - Timeout (in seconds) for waiting for vSwitch servers to be configured.
    type: int

wait_delay:
    default: 10
    description:
    - Delay to wait (in seconds) before checking again whether the vSwitch servers has
      been configured.
    type: int

hetzner_user:
    description: The username for the Robot webservice user.
    required: true
    type: str

hetzner_password:
    description: The password for the Robot webservice user.
    required: true
    type: str

Outputs

v_switch:
  contains:
    cancelled:
      description:
      - Cancellation status.
      returned: success
      sample: false
      type: bool
    cloud_network:
      contains:
        gateway:
          description:
          - Gateway.
          sample: 10.0.2.1
          type: str
        id:
          description:
          - Cloud network ID.
          sample: 123
          type: int
        ip:
          description:
          - IP address.
          sample: 10.0.2.0
          type: str
        mask:
          description:
          - Subnet mask in CIDR notation.
          sample: 24
          type: int
      description:
      - List of assigned Cloud networks.
      elements: dict
      returned: success
      sample:
      - gateway: 10.0.2.1
        id: 123
        ip: 10.0.2.0
        mask: 24
      type: list
    id:
      description:
      - The vSwitch's ID.
      returned: success
      sample: 4321
      type: int
    name:
      description:
      - The vSwitch's name.
      returned: success
      sample: my vSwitch
      type: str
    server:
      contains:
        server_ip:
          description:
          - The server's main IP address.
          sample: 123.123.123.123
          type: str
        server_ipv6_net:
          description:
          - The server's main IPv6 network address.
          sample: '2a01:f48:111:4221::'
          type: str
        server_number:
          description:
          - The server's numeric ID.
          sample: 321
          type: int
        status:
          choices:
          - ready
          - in process
          - failed
          description:
          - Status of vSwitch for this server.
          sample: ready
          type: str
      description:
      - The vSwitch's VLAN.
      elements: dict
      returned: success
      sample:
      - server_ip: 123.123.123.123
        server_ipv6_net: '2a01:4f8:111:4221::'
        server_number: 321
        status: ready
      type: list
    subnet:
      contains:
        gateway:
          description:
          - Gateway of the subnet.
          sample: 213.239.252.49
          type: str
        ip:
          description:
          - IP address.
          sample: 213.239.252.48
          type: str
        mask:
          description:
          - Subnet mask in CIDR notation.
          sample: 29
          type: int
      description:
      - List of assigned IP addresses.
      elements: dict
      returned: success
      sample:
      - gateway: 213.239.252.49
        ip: 213.239.252.48
        mask: 29
      type: list
    vlan:
      description:
      - The vSwitch's VLAN ID.
      returned: success
      sample: 4000
      type: int
  description:
  - Information on the vSwitch.
  returned: success
  type: dict

See also