Molecule Hetzner Cloud Driver
A Hetzner Cloud driver for Molecule.
This plugin allows you to use on-demand Hetzner Cloud servers for your molecule integration tests.
Install
$ pip install molecule-hetznercloud
Upgrade
This project adheres to Semantic Versioning.
$ pip install --upgrade molecule-hetznercloud
Upgrading to v2
- In your
molecule.ymlfiles, rename the molecule driver name (driver.name) tomolecule_hetznercloud:
driver:
- name: hetznercloud
+ name: molecule_hetznercloud
- In your
molecule.ymlfiles, the volumes name (platforms[].volumes[].name) field is now required. If the field is missing, you MUST add it:
platforms:
- name: instance-1
image: debian-12
volumes:
- - size: 20
+ - name: volume-1
+ size: 20
-
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. -
In your
molecule.ymlfiles, the platforms server type (platforms[].server_type) field now defaults tocx22. If you already use the default, you MAY remove the field:
platforms:
- name: instance-1
image: debian-12
- server_type: cx22
Usage
To 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.
$ export HCLOUD_TOKEN="set_the_hcloud_token_here"
Then setup a new molecule scenario using the driver plugin.
$ molecule init scenario --driver-name molecule_hetznercloud
Your molecule/default/molecule.yml should then look like the following.
---
driver:
name: molecule_hetznercloud
platforms:
- # Name of the Server to create (must be unique per Project and a valid hostname as per RFC 1123).
# required
name: instance-1
# Name of the Image the Server is created from.
# required
image: debian-12
# Name of the Server type this Server should be created with.
# default: cx23
server_type: cx23
# Name of Location to create Server in.
# default: omit
location: hel1
# Cloud-Init user data to use during Server creation. This field is limited to 32KiB.
# default: omit
user_data: null
# List of volumes to attach to the server.
volumes:
- # Name of the volume.
# required
name: volume-1
# Size of the Volume in GB.
# default: 10
size: 10
# Dictionary of private networks the server should be attached to.
networks:
# Name of the network
network-1:
# IP range of the whole network which must span all included subnets. Must be one of the private IPv4 ranges of RFC1918.
# If multiple hosts using the same network, you may only define it once.
# required
ip_range: 10.0.0.0/16
subnet:
# IP to assign to the server.
# required
ip: 10.0.0.1/24
# Type of subnetwork.
# default: cloud
type: cloud
# Name of network zone.
# default: eu-central
network_zone: eu-central
network-2:
ip_range: 10.1.0.0/16
subnet:
ip: 10.1.0.1/24
Then test your role.
$ molecule test
To ease initial debugging for getting things started, also expose the following environment variables.
$ export MOLECULE_NO_LOG=False # not so verbose, helpful
$ export MOLECULE_DEBUG=True # very verbose, last ditch effort
You may also define a custom resource namespace by exposing the following environment variables, for example in CI workflows:
$ export RESOURCE_NAMESPACE=e121dc64ff615ccdfac71bb5c00296b9 # Ensure the value length is <= 32
Development
Testing
Run unit tests:
make test
Run integration tests
export HCLOUD_TOKEN="set_the_hcloud_token_here"
make integration
History
The project was initially maintained by @decentral1se. After a long period looking for new maintainers, the project was archived in early 2023.
In September 2023, the code has been rewritten by @jooola and the project was reactivated to continue development.
License
The LGPLv3 license.
Metadata
Release files for molecule-hetznercloud 2.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| molecule_hetznercloud-2.8.0.tar.gz | 14.7 kB | With provenance | Details for molecule_hetznercloud-2.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| molecule_hetznercloud-2.8.0-py3-none-any.whl | Python 3 | none | any | Details for molecule_hetznercloud-2.8.0-py3-none-any.whl |
Total release size: 30.1 kB
Release files / molecule_hetznercloud-2.8.0.tar.gz
| Download URL | molecule_hetznercloud-2.8.0.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
717c3c8811e5d2ad7afe5fefe6b7f6b7d68245318a62cdedda392b6bc69350bb
|
|
BLAKE2b-256 checksum How to use checksums |
4fffe9c500755577a405759e6b33bc42257c0e31804e199cdfa9db4ecb44b516
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 24, 2026.
Transparency logRelease files / molecule_hetznercloud-2.8.0-py3-none-any.whl
| Download URL | molecule_hetznercloud-2.8.0-py3-none-any.whl |
|---|---|
| Size | 15.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
129f670e6eb4153cd311c43ea565eeea12d094b78a3a09740a35c446579ea932
|
|
BLAKE2b-256 checksum How to use checksums |
3b803e82f335c3d83316df566cbb33253ab73651601f213c9fb935b16e172994
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 24, 2026.
Transparency logSecurity for molecule-hetznercloud 2.8.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for molecule_hetznercloud-2.8.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.