ansible.builtin.hcloud_server_network (v2.9.25) — module

Manage the relationship between Hetzner Cloud Networks and servers

| "added in version" 2.9 of ansible.builtin"

Authors: Lukas Kaemmerling (@lkaemmerling)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.25

Description

Create and delete the relationship Hetzner Cloud Networks and servers


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a basic server network
  hcloud_server_network:
    network: my-network
    server: my-server
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a server network and specify the ip address
  hcloud_server_network:
    network: my-network
    server: my-server
    ip: 10.0.0.1
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a server network and add alias ips
  hcloud_server_network:
    network: my-network
    server: my-server
    ip: 10.0.0.1
    alias_ips:
       - 10.1.0.1
       - 10.2.0.1
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure the server network is absent (remove if needed)
  hcloud_server_network:
    network: my-network
    server: my-server
    state: absent

Inputs

    
ip:
    description:
    - The IP the server should have.
    type: str

state:
    choices:
    - absent
    - present
    default: present
    description:
    - State of the server_network.
    type: str

server:
    description:
    - The name of the Hetzner Cloud server.
    required: true
    type: str

network:
    description:
    - The name of the Hetzner Cloud Networks.
    required: true
    type: str

endpoint:
    default: https://api.hetzner.cloud/v1
    description:
    - This is the API Endpoint for the Hetzner Cloud.
    type: str

alias_ips:
    description:
    - Alias IPs the server has.
    type: list

api_token:
    description:
    - This is the API Token for the Hetzner Cloud.
    required: true
    type: str

Outputs

hcloud_server_network:
  contains:
    alias_ips:
      description: Alias IPs of the server within the Network ip range
      returned: always
      sample:
      - 10.1.0.1
      - '...'
      type: str
    ip:
      description: IP of the server within the Network ip range
      returned: always
      sample: 10.0.0.8
      type: str
    network:
      description: Name of the Network
      returned: always
      sample: my-network
      type: str
    server:
      description: Name of the server
      returned: always
      sample: my-server
      type: str
  description: The relationship between a server and a network
  returned: always
  type: complex

See also