Skip to content
This repository has been archived by the owner on Jul 13, 2019. It is now read-only.

Commit

Permalink
Add cloud init example (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
thetechnick authored Aug 3, 2018
1 parent 0ed9563 commit d5acb7c
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions docs/hcloud_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,25 @@
Manages Hetzner Cloud servers. This module can be used to create, modify, delete and reboot servers.

## Requirements (on host that executes module)

- ansible >= 2.2.x (binary module support)

## Options
|parameter|required|default|choices|comments|
|---------|--------|-------|-------|--------|
|token|no|||Hetzner Cloud API Token. Can also be specified with `HCLOUD_TOKEN` environment variable. |
|state|no|present|<ul><li>present</li><li>absent</li><li>running</li><li>stopped</li><li>restarted</li><li>list</li></ul>| |
| id | no | | | A single id or list of ids. Either `id` or `name` must be set. |
| name | no | | | A single name or list of names. Either `id` or `name` must be set. |
| image | no | | | Required when a server needs to be created. |
| server_type | no | | | Required when a server needs to be created. |
| user_data | no | | | cloud-init userdata |
| datacenter | no | | | Mutually exclusive with `location` |
| location | no | | | Mutually exclusive with `datacenter` |
| rescue | no | | <ul><li>linux64</li><li>linux32</li><li>freebsd64</li></ul> | Will make sure the choosen rescue system is enabled. Automatically resets the server to boot into the rescue system if `state != stopped`. |
| ssh_keys | no | | | List of Hetzner Cloud SSHKey ids, names or dict containing the `id` or `name`. |
| iso | no | | | `name` or `id` of the iso image to attach. |

| parameter | required | default | choices | comments |
| ----------- | -------- | ------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| token | no | | | Hetzner Cloud API Token. Can also be specified with `HCLOUD_TOKEN` environment variable. |
| state | no | present | <ul><li>present</li><li>absent</li><li>running</li><li>stopped</li><li>restarted</li><li>list</li></ul> | |
| id | no | | | A single id or list of ids. Either `id` or `name` must be set. |
| name | no | | | A single name or list of names. Either `id` or `name` must be set. |
| image | no | | | Required when a server needs to be created. |
| server_type | no | | | Required when a server needs to be created. |
| user_data | no | | | cloud-init userdata |
| datacenter | no | | | Mutually exclusive with `location` |
| location | no | | | Mutually exclusive with `datacenter` |
| rescue | no | | <ul><li>linux64</li><li>linux32</li><li>freebsd64</li></ul> | Will make sure the choosen rescue system is enabled. Automatically resets the server to boot into the rescue system if `state != stopped`. |
| ssh_keys | no | | | List of Hetzner Cloud SSHKey ids, names or dict containing the `id` or `name`. |
| iso | no | | | `name` or `id` of the iso image to attach. |

## Return Values

Expand All @@ -41,7 +43,6 @@ servers:
## Examples
```yaml

# create a single server
- hcloud_server:
name: example-server
Expand All @@ -52,7 +53,7 @@ servers:
- user@example-notebook # by name
- 1234 # by id

# create tree servers at once
# create three servers at once
- hcloud_server:
name:
- example-server01
Expand All @@ -70,6 +71,16 @@ servers:
name: example-server
state: running

# create a server with cloud init user data
- hcloud_server:
name: cloudinit
image: debian-9
server_type: cx11
user_data: |
#cloud-config
runcmd:
- [touch, /root/cloud-init-worked]
- hcloud_server:
id: 123
state: running
Expand Down

0 comments on commit d5acb7c

Please sign in to comment.