This role deploys one or more virtual machines with additional disks in the hetzner cloud.
What happens:
- The specified SSH public key will be created in your account
- The list of servers will get created with access for the specified SSH key as root (as long as you use the hetzner images)
- The list of volumes for each server will get created and the volumes will get attached to the matching server
Current module/API problems:
When you delete a server and instantly after that delete the volumes that were attached to the server, the API reports that these volumes are still attached to a server and can not be deleted.
This happens when you run this role and set the state of a server to absend
and also set the state of the volume that was/is attached to the server to absent
.
ansible-galaxy install --roles-path ./roles/ siw36.ansible_hcloud_vm
- Python module:
hcloud
(This role will install it to the users python module directory automatically)
Name | Description | Default value |
---|---|---|
getInfoOnly | Get possible values for server type, image and location. Only the information will get printed when this variable is set to true. | false |
hcloudBearer | Your Hetzner Cloud API key. Can be found in your project in the SSH key tab. | <none - required to be set> |
sshKey | Dictionary containing 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 below example for details on how to specify the variables
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)
GNU General Public License v3.0
Created by Robin 'siw36' Klussmann (07/2019)