Note
This plugin is part of the hetzner.hcloud collection.
To install it use: ansible-galaxy collection install hetzner.hcloud.
To use it in a playbook, specify: hetzner.hcloud.hcloud_server_network.
The below requirements are needed on the host that executes this module.
| Parameter | Choices/Defaults | Comments |
|---|---|---|
| alias_ips list / elements=string | Alias IPs the server has. | |
| api_token string / required | This is the API Token for the Hetzner Cloud. | |
| endpoint string | Default: "https://api.hetzner.cloud/v1" | This is the API Endpoint for the Hetzner Cloud. |
| ip string | The IP the server should have. | |
| network string / required | The name of the Hetzner Cloud Networks. | |
| server string / required | The name of the Hetzner Cloud server. | |
| state string |
| State of the server_network. |
See also
Complete reference for the Hetzner Cloud API.
- name: Create a basic server network
hcloud_server_network:
network: my-network
server: my-server
state: present
- 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
- 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
- name: Ensure the server network is absent (remove if needed)
hcloud_server_network:
network: my-network
server: my-server
state: absent
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | |
|---|---|---|---|
| hcloud_server_network complex | always | The relationship between a server and a network | |
| alias_ips string | always | Alias IPs of the server within the Network ip range Sample: ['10.1.0.1', '...'] | |
| ip string | always | IP of the server within the Network ip range Sample: 10.0.0.8 | |
| network string | always | Name of the Network Sample: my-network | |
| server string | always | Name of the server Sample: my-server | |
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/hetzner/hcloud/hcloud_server_network_module.html