Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hg8496/ansible-hcloud-inventory
An dynamic inventory script for hetzner cloud
https://github.com/hg8496/ansible-hcloud-inventory
ansible ansible-inventory hcloud
Last synced: 3 months ago
JSON representation
An dynamic inventory script for hetzner cloud
- Host: GitHub
- URL: https://github.com/hg8496/ansible-hcloud-inventory
- Owner: hg8496
- License: mit
- Created: 2018-02-15T23:20:47.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-05T09:43:35.000Z (over 4 years ago)
- Last Synced: 2024-06-22T03:41:16.007Z (5 months ago)
- Topics: ansible, ansible-inventory, hcloud
- Language: Python
- Size: 28.3 KB
- Stars: 60
- Watchers: 6
- Forks: 18
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-hcloud - ansible-hcloud-inventory
README
# ansible-hcloud-inventory
A dynamic inventory script for hetzner cloud.Usage:
`HCLOUD_TOKEN=example ansible-playbook site.yml -u root -i hcloud.py`
or
`ansible-playbook site.yml -u root -i "hcloud.py cloud_token"`
or
`ansible-playbook site.yml -u root -i "hcloud.py @cloud_token.yml"`Token yaml file must contain 'hcloud_token' variable with token. This method allows that you use many of token or store token with vault.
Dependencies:
* requests(`apt install python-request` or `pip install -r requirements.txt`)The inventory will consist of multiple groups:
Name | Description
---- | ----
all | contains all hosts
hcloud | contains all hosts in Hetzner Cloud
fsn1_dc8 | contains all hosts in datacenter Falkenstein
nbg1_dc3 | contains all hosts in datacenter Nürnberg
label1_value1 | contains all hosts have label "label1"="value1"
label1_value2 | contains all hosts have label "label1"="value2"The host has the following hostvars:
Name | Description
---- | ----
ansible_host | Public or private IPv4 or IPv6 Address
ansible_public_net | Public IPv4 Address
ansible_private_net | Private IPv4 Address
hcloud_server_type | Servertype eg. CX11
hcloud_image | Name of the used image
hcloud_datacenter | Datacenter the server is running in
hcloud_labels | Instance labelsCheck the [hcloud.ini](hcloud.ini) for a short explanation on how to use the ipv6 address of a server as or the private ip address of a server as value for `ansible_host`.
In [hcloud.ini](hcloud.ini) it is also possible to add aliases for the label groups created. So instead of `DNS_true` you can use `dnsservers` as group identifier.