This script generates a inventory in the INI format. It will look like this:
[hetzner]
server-1 ansible_host=server1.example.com ansible_user=root
server-2 ansible_host=server2.example.com ansible_user=root
server-3 ansible_host=server3.example.com ansible_user=root
You have to set the enviroment variabel HETZNER_CLOUD_API_KEY
with your Hetzner API token.
# Build
make
# Run
HETZNER_CLOUD_API_KEY=ABCDE1337 ./hcloud-ansible-inventory --inventory-file my-inventory.yaml