siw36.ansible_hcloud_vm
ansible-hcloud-vm
=========
This role helps to set up one or more virtual machines with extra disks in Hetzner Cloud.
What happens:
- Your specified SSH public key will be created in your account.
- A list of servers will be made, giving root access with the specified SSH key (if using Hetzner images).
- A list of volumes for each server will be created, and these volumes will be attached to the corresponding server.
Current module/API issues:
When you delete a server and then quickly delete the volumes attached to it, the API may say these volumes are still connected to a server and cannot be deleted. This can occur if you run this role and set the server's state to absent, while also marking the volume attached to this server as absent.
Get this role
To install the role, use:
ansible-galaxy install --roles-path ./roles/ siw36.ansible_hcloud_vm
Requirements
- Python module:
hcloud(This role will automatically install it to the user's Python module directory)
Role Variables
| Name | Description | Default value |
|---|---|---|
| getInfoOnly | Get possible values for server type, image, and location. Only prints information if this is set to true. | false |
| hcloudBearer | Your Hetzner Cloud API key, found in your project under the SSH key tab. | <none - __required__ to be set> |
| sshKey | Information about the root SSH key | <none - __required__ to be set> |
| deployments | List of deployments and their disks | <none - __required__ to be set> |
See the example below for how to specify the variables
Example Playbook
playbook.yml:
- hosts: localhost
become: false
gather_facts: false
roles:
- siw36.ansible_hcloud_vm
roles/siw36.ansible_hcloud_vm/vars/main.yml
#getInfoOnly: false
hcloudBearer: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
sshKey:
name: root
value: ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx root
state: present
deployments:
- name: test0.nodes.replicas.io
state: absent # (present|started|stopped|restarted|absent|rebuild)
size: cx11
location: hel1
image: centos-7
backup: false
sshKeys:
- siw
labels:
project: replicas.io
stage: prod
location: helsinki
volumes:
- name: test0.nodes.replicas.io-data0
state: absent # (present|absent)
size: 10
automount: true
format: xfs # (xfs|ext4)
License
GNU General Public License v3.0
Author Information
Created by Robin 'siw36' Klussmann (07/2019)
Informazioni sul progetto
Role to deploy servers on Hetzner Cloud
Installa
ansible-galaxy install siw36.ansible_hcloud_vmLicenza
gpl-3.0
Download
176
Proprietario
Platform & DevOps Engineer
