{"id":13702846,"url":"https://github.com/ansible-community/molecule-hetznercloud","last_synced_at":"2025-04-06T16:12:35.627Z","repository":{"id":42372554,"uuid":"203981893","full_name":"ansible-community/molecule-hetznercloud","owner":"ansible-community","description":"A molecule driver for Hetzner Cloud","archived":false,"fork":false,"pushed_at":"2025-04-02T13:55:44.000Z","size":399,"stargazers_count":27,"open_issues_count":2,"forks_count":14,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-04-04T23:02:46.957Z","etag":null,"topics":["ansible","hetzner","hetzner-cloud","molecule","molecule-driver"],"latest_commit_sha":null,"homepage":"https://ansible.readthedocs.io/projects/molecule/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ansible-community.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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},"funding":{"github":"decentral1se","liberapay":"decentral1se"}},"created_at":"2019-08-23T11:00:21.000Z","updated_at":"2025-04-02T13:55:16.000Z","dependencies_parsed_at":"2023-01-28T00:16:16.395Z","dependency_job_id":"7278dd59-97cb-4b6e-b539-31eead5d3792","html_url":"https://github.com/ansible-community/molecule-hetznercloud","commit_stats":{"total_commits":188,"total_committers":13,"mean_commits":"14.461538461538462","dds":0.4787234042553191,"last_synced_commit":"ec69b13be368f773fd39c14779c42958555b8c20"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansible-community%2Fmolecule-hetznercloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansible-community%2Fmolecule-hetznercloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansible-community%2Fmolecule-hetznercloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansible-community%2Fmolecule-hetznercloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ansible-community","download_url":"https://codeload.github.com/ansible-community/molecule-hetznercloud/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247509235,"owners_count":20950232,"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","hetzner","hetzner-cloud","molecule","molecule-driver"],"created_at":"2024-08-02T21:00:44.189Z","updated_at":"2025-04-06T16:12:35.601Z","avatar_url":"https://github.com/ansible-community.png","language":"Python","funding_links":["https://github.com/sponsors/decentral1se","https://liberapay.com/decentral1se"],"categories":["Integrations"],"sub_categories":["Rust"],"readme":"# Molecule Hetzner Cloud Driver\n\n[![PyPI Package](https://img.shields.io/pypi/v/molecule-hetznercloud)](https://pypi.org/project/molecule-hetznercloud/)\n[![Codecov](https://img.shields.io/codecov/c/github/ansible-community/molecule-hetznercloud/main)](https://app.codecov.io/gh/ansible-community/molecule-hetznercloud/tree/main)\n[![License](https://img.shields.io/badge/license-LGPL-brightgreen.svg)](LICENSE)\n\nA [Hetzner Cloud](https://www.hetzner.com/cloud) driver for [Molecule](https://ansible.readthedocs.io/projects/molecule/).\n\nThis plugin allows you to use on-demand Hetzner Cloud servers for your molecule integration tests.\n\n## Install\n\n```bash\n$ pip install molecule-hetznercloud\n```\n\n## Upgrade\n\nThis project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n```bash\n$ pip install --upgrade molecule-hetznercloud\n```\n\n### Upgrading to v2\n\n- In your `molecule.yml` files, rename the molecule driver name (`driver.name`) to `molecule_hetznercloud`:\n\n```patch\n driver:\n-  name: hetznercloud\n+  name: molecule_hetznercloud\n```\n\n- In your `molecule.yml` files, the volumes name (`platforms[].volumes[].name`) field is now required. If the field is missing, you MUST add it:\n\n```patch\n platforms:\n   - name: instance-1\n     image: debian-12\n     volumes:\n-     - size: 20\n+     - name: volume-1\n+       size: 20\n```\n\n- Each resource (servers, volumes, networks) name are prefixed with a hash (32 chars) based on the role and scenario path. This means you MAY reuse the same names (e.g. `instance-1`) across your scenarios. Resource names MUST not exceed their max length, for example the server name max length is 63 chars, with the prefix you only have 31 chars left for your name.\n\n- In your `molecule.yml` files, the platforms server type (`platforms[].server_type`) field now defaults to `cx22`. If you already use the default, you MAY remove the field:\n\n```patch\n platforms:\n   - name: instance-1\n     image: debian-12\n-    server_type: cx22\n```\n\n## Usage\n\nTo communicate with the Hetzner Cloud API, you need to expose a `HCLOUD_TOKEN` environment variable. Find out more about how to get a Hetzner Cloud API token in the [authentication documentation](https://docs.hetzner.cloud/#authentication).\n\n```bash\n$ export HCLOUD_TOKEN=\"set_the_hcloud_token_here\"\n```\n\nThen setup a new molecule scenario using the driver plugin.\n\n```bash\n$ molecule init scenario --driver-name molecule_hetznercloud\n```\n\n\u003e [!WARNING]\n\u003e With molecule 6, the `molecule init scenario` command dropped support for driver provided configuration. If you are using molecule \u003e=6, please copy the example below and paste it in your scenario `molecule.yml` file.\n\u003e See [this commit](https://github.com/ansible/molecule/commit/21dcd2bb7e8e9002be8bbc19de3e66ec3ce586f1) for details.\n\nYour `molecule/default/molecule.yml` should then look like the following.\n\n```yaml\n---\ndriver:\n  name: molecule_hetznercloud\nplatforms:\n  - # Name of the Server to create (must be unique per Project and a valid hostname as per RFC 1123).\n    # required\n    name: instance-1\n    # Name of the Image the Server is created from.\n    # required\n    image: debian-12\n    # Name of the Server type this Server should be created with.\n    # default: cx22\n    server_type: cx22\n    # Name of Location to create Server in (must not be used together with datacenter).\n    # default: omit\n    location: hel1\n    # Name of Datacenter to create Server in (must not be used together with location).\n    # default: omit\n    datacenter: null\n    # Cloud-Init user data to use during Server creation. This field is limited to 32KiB.\n    # default: omit\n    user_data: null\n\n    # List of volumes to attach to the server.\n    volumes:\n      - # Name of the volume.\n        # required\n        name: volume-1\n        # Size of the Volume in GB.\n        # default: 10\n        size: 10\n\n    # Dictionary of private networks the server should be attached to.\n    networks:\n      # Name of the network\n      network-1:\n        # IP range of the whole network which must span all included subnets. Must be one of the private IPv4 ranges of RFC1918.\n        # If multiple hosts using the same network, you may only define it once.\n        # required\n        ip_range: 10.0.0.0/16\n        subnet:\n          # IP to assign to the server.\n          # required\n          ip: 10.0.0.1/24\n          # Type of subnetwork.\n          # default: cloud\n          type: cloud\n          # Name of network zone.\n          # default: eu-central\n          network_zone: eu-central\n      network-2:\n        ip_range: 10.1.0.0/16\n        subnet:\n          ip: 10.1.0.1/24\n```\n\n\u003e [!NOTE]\n\u003e The `networks.ip_range` is important for creating. If you have multiple\n\u003e hosts, you may only define it once.\n\n\u003e [!NOTE]\n\u003e You may list the server types and available images using the `hcloud` command line tool:\n\u003e\n\u003e ```bash\n\u003e # List server types\n\u003e $ hcloud server-type list --sort name\n\u003e # List images for the x86 architecture\n\u003e $ hcloud image list --type system --architecture x86 --sort name\n\u003e ```\n\nThen test your role.\n\n```bash\n$ molecule test\n```\n\nTo ease initial debugging for getting things started, also expose the following\nenvironment variables.\n\n```bash\n$ export MOLECULE_NO_LOG=False  # not so verbose, helpful\n$ export MOLECULE_DEBUG=True  # very verbose, last ditch effort\n```\n\nYou may also define a custom resource namespace by exposing the following\nenvironment variables, for example in CI workflows:\n\n```bash\n$ export RESOURCE_NAMESPACE=e121dc64ff615ccdfac71bb5c00296b9 # Ensure the value length is \u003c= 32\n```\n\n## Development\n\n### Testing\n\nRun unit tests:\n\n```bash\nmake test\n```\n\nRun integration tests\n\n```bash\nexport HCLOUD_TOKEN=\"set_the_hcloud_token_here\"\nmake integration\n```\n\n## History\n\nThe project was initially maintained by [@decentral1se](https://github.com/decentral1se). After a long period [looking for new maintainers](https://github.com/ansible-community/molecule-hetznercloud/issues/43), the project was archived in early 2023.\n\nIn September 2023, the code has been rewritten by [@jooola](https://github.com/jooola) and the project was reactivated to continue development.\n\n## License\n\nThe [LGPLv3](https://www.gnu.org/licenses/lgpl-3.0.en.html) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fansible-community%2Fmolecule-hetznercloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fansible-community%2Fmolecule-hetznercloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fansible-community%2Fmolecule-hetznercloud/lists"}