{"id":13702571,"url":"https://github.com/ngine-io/ansible-role-hcloud","last_synced_at":"2025-10-11T04:17:40.878Z","repository":{"id":37005286,"uuid":"486211387","full_name":"ngine-io/ansible-role-hcloud","owner":"ngine-io","description":"Ansible Role for Hetzner Cloud hcloud ","archived":false,"fork":false,"pushed_at":"2024-06-19T06:17:38.000Z","size":32,"stargazers_count":11,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-10T11:12:31.797Z","etag":null,"topics":["ansible","ansible-role","ansible-roles","cloud","hcloud","hetzner","hetzner-cloud"],"latest_commit_sha":null,"homepage":"https://galaxy.ansible.com/ngine_io/hcloud","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ngine-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-27T13:48:52.000Z","updated_at":"2025-05-25T23:01:40.000Z","dependencies_parsed_at":"2024-01-14T19:14:13.561Z","dependency_job_id":"6e44cc3b-911f-4613-98b8-1d8c3fc83e10","html_url":"https://github.com/ngine-io/ansible-role-hcloud","commit_stats":{"total_commits":18,"total_committers":4,"mean_commits":4.5,"dds":"0.38888888888888884","last_synced_commit":"a8fadae3265859b7ee120f694ee11911f9b21749"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ngine-io/ansible-role-hcloud","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngine-io%2Fansible-role-hcloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngine-io%2Fansible-role-hcloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngine-io%2Fansible-role-hcloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngine-io%2Fansible-role-hcloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ngine-io","download_url":"https://codeload.github.com/ngine-io/ansible-role-hcloud/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngine-io%2Fansible-role-hcloud/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263091025,"owners_count":23412343,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-role","ansible-roles","cloud","hcloud","hetzner","hetzner-cloud"],"created_at":"2024-08-02T21:00:38.202Z","updated_at":"2025-10-11T04:17:35.830Z","avatar_url":"https://github.com/ngine-io.png","language":null,"funding_links":[],"categories":["Tools"],"sub_categories":["Rust"],"readme":"# Ansible Role: Hetzner Cloud hcloud\n\n[![CI](https://github.com/ngine-io/ansible-role-hcloud/workflows/CI/badge.svg?event=push)](https://github.com/ngine-io/ansible-role-hcloud/actions?query=workflow%3ACI)\n\nManages compute resources on [Hetzner Cloud](https://www.hetzner.com/cloud).\n\n## Dependencies\n\nSee `requirements.txt` for python library dependencies.\n\n## Examples\n\n### Inventory\n\nGiven is a inventory similar as:\n\n```ini\n[web]\nweb-1\nweb-2\nweb-3\n```\n\n### Variables\n\nThe following variables are meant to be set in a top level group, e.g.`group_vars/all.yml`.\n\nAPI key:\n\n\u003e NOTE: Recommended to encrypt this token with Ansible Vault or use a lookup to your secrets management system!\n\n```yaml\nhcloud__api_token: ...\n```\n\nEnsures a private network is created:\n\n```yaml\nhcloud__networks:\n  - name: internal\n    network: 10.10.10.0/24\n```\n\nEnsure some firewalls and rules are created:\n\n```yaml\nhcloud__firewalls:\n  - name: default\n    rules:\n      - direction: in\n        protocol: icmp\n        source_ips:\n          - 0.0.0.0/0\n          - ::/0\n      - direction: in\n        protocol: tcp\n        port: \"22\"\n        source_ips:\n          - 0.0.0.0/0\n  - name: web\n    rules:\n      - direction: in\n        protocol: tcp\n        port: \"80\"\n        source_ips:\n          - 0.0.0.0/0\n          - ::/0\n      - direction: in\n        protocol: tcp\n        port: \"443\"\n        source_ips:\n          - 0.0.0.0/0\n          - ::/0\n```\n\nEnsure placment groups are created:\n\n```yaml\nhcloud__placement_groups:\n  - name: my placement group\n    labels:\n       project: genesis\n```\n\n#### Loadbalancers\n\nConfigure a simple load balancer and add servers as targets later (see server configs):\n\n```yaml\nhcloud__loadbalancers:\n  - name: my load balancer\n    type: lb11\n    services:\n      - protocol: http\n        port: 80\n      - protocol: tcp\n        port: 443\n        destination_port: 443\n```\n\nConfigure a load balancer and use label selector hcloud feature:\n\n```yaml\nhcloud__loadbalancers:\n  - name: my load balancer\n    type: lb11\n    targets:\n      - type: label_selector\n        label_selector: app=public\n    services:\n      - protocol: http\n        port: 80\n        health_check:\n          interval: 15\n          port: 80\n          timeout: 3\n          retries: 3\n          protocol: http\n          http:\n            # Single wildcard char '?' or glob wildcard '*'\n            status_codes:\n              - 2*\n              - 3*\n              - 40?\n            # Optional\n            path: /\n            domain: www.example.com\n            response: hello world\n      - protocol: tcp\n        port: 443\n        destination_port: 443\n```\n\n#### Server Configs\n\nThe following configs are server specific and meant to be set in a lower level `group_vars` or `host_vars`, e.g. `group_vars/web.yml`\n\nServer image to use:\n\n```yaml\nhcloud__server_image: debian-11\n```\n\nLocation to deploy into:\n\n```yaml\nhcloud__server_location: fsn1\n```\n\nEnsure web servers have these firewalls configured:\n\n```yaml\nhcloud__server_firewalls:\n  - default\n  - web\n```\n\nEnsure web servers are attached to these networks:\n\n```yaml\nhcloud__server_networks:\n  - name: internal\n```\n\nEnsure web servers are in a placement group:\n\n```yaml\nhcloud__server_placement_group: my placement group\n```\n\nAdd server to an existing loadbalancer as server target (optionally use private IP):\n\n```yaml\nhcloud__server_loadbalancer_name: my load balancer\nhcloud__server_loadbalancer_use_private_ip: true\n```\n\nEnsure web server have this type:\n\n```yaml\nhcloud__server_type: cpx11\n```\n\nUser data to be executed on boot, e.g.:\n\n```yaml\nhcloud__server_user_data: |\n  #cloud-config\n  users:\n    - name: admin\n      groups: users, admin\n      sudo: ALL=(ALL) NOPASSWD:ALL\n      shell: /bin/bash\n      ssh_authorized_keys:\n        - \u003cpublic_ssh_key\u003e\n  packages:\n    - fail2ban\n  package_update: true\n  package_upgrade: true\n```\n\nEnsure a volume is created and attached to the server:\n\n\u003e HINT: Use the special variable `inventory_hostname_short` as prefix to easily identify which volume is attached to which server.\n\n```yaml\nhcloud__server_volumes:\n  - name: \"{{ inventory_hostname_short }}-vol1\"\n    format: ext4\n    size: 10\n```\n\n### Playbook\n\nA typical playbook would look like this.\n\n```yaml\n---\n- name: Provision Cloud servers\n  hosts: all\n  serial: 5\n  gather_facts: false\n  roles:\n    - role: ngine_io.hcloud\n      delegate_to: localhost\n\n  post_tasks:\n    - name: Wait for SSH access\n      delegate_to: localhost\n      wait_for:\n        host: \"{{ ansible_host }}\"\n        port: 22\n        timeout: 60\n```\n\n## License\n\nMIT\n\n## Author Information\n\nRené Moser (@resmo)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fngine-io%2Fansible-role-hcloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fngine-io%2Fansible-role-hcloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fngine-io%2Fansible-role-hcloud/lists"}