### Install Molecule Hetzner Cloud Plugin and Ansible Collection Source: https://github.com/ansible-community/molecule-hetznercloud/blob/main/molecule_hetznercloud/cookiecutter/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/INSTALL.rst These commands install the `molecule-hetznercloud` Python package using pip and the `hetzner.hcloud` Ansible collection using `ansible-galaxy`, which are essential for using the Molecule Hetzner Cloud plugin. ```bash pip install molecule-hetznercloud ansible-galaxy collection install hetzner.hcloud ``` -------------------------------- ### Install Molecule Hetzner Cloud Driver Source: https://github.com/ansible-community/molecule-hetznercloud/blob/main/README.md This command installs the Molecule Hetzner Cloud driver using pip, the Python package installer. It fetches the latest stable version from PyPI. ```bash $ pip install molecule-hetznercloud ``` -------------------------------- ### Initialize Molecule Scenario with Hetzner Cloud Driver Source: https://github.com/ansible-community/molecule-hetznercloud/blob/main/README.md This command initializes a new Molecule scenario, specifically configuring it to use the `molecule_hetznercloud` driver. For Molecule versions 6 and above, driver-provided configuration is no longer supported, requiring manual `molecule.yml` setup. ```bash $ molecule init scenario --driver-name molecule_hetznercloud ``` -------------------------------- ### Run Molecule Scenario Tests Source: https://github.com/ansible-community/molecule-hetznercloud/blob/main/README.md After configuring the Molecule scenario, this command executes the defined tests. It orchestrates the creation, provisioning, and testing of the infrastructure as specified in the `molecule.yml` and associated playbooks. ```bash $ molecule test ``` -------------------------------- ### Run Unit Tests for Molecule Hetzner Cloud Driver Source: https://github.com/ansible-community/molecule-hetznercloud/blob/main/README.md This command executes the unit tests for the `molecule-hetznercloud` project. It's part of the development workflow to ensure individual components function correctly. ```bash make test ``` -------------------------------- ### List Hetzner Cloud Server Types and Images Source: https://github.com/ansible-community/molecule-hetznercloud/blob/main/README.md These `hcloud` command-line tool commands help in discovering available server types and images. They are useful for populating the `image` and `server_type` fields in the `molecule.yml` configuration, allowing users to select appropriate resources for their Molecule scenarios. ```bash # List server types $ hcloud server-type list --sort name # List images for the x86 architecture $ hcloud image list --type system --architecture x86 --sort name ``` -------------------------------- ### Run Integration Tests for Molecule Hetzner Cloud Driver Source: https://github.com/ansible-community/molecule-hetznercloud/blob/main/README.md This command runs the integration tests for the `molecule-hetznercloud` project, requiring the `HCLOUD_TOKEN` to be set. These tests validate the interaction of the driver with the actual Hetzner Cloud API. ```bash export HCLOUD_TOKEN="set_the_hcloud_token_here" make integration ``` -------------------------------- ### Molecule Hetzner Cloud Platform Configuration (molecule.yml) Source: https://github.com/ansible-community/molecule-hetznercloud/blob/main/README.md This YAML configuration defines the platform settings for Molecule when using the `molecule_hetznercloud` driver. It specifies server details like name, image, server type, location, user data, and optional volume and network attachments, including IP ranges and subnets. ```yaml --- 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: cx22 server_type: cx22 # Name of Location to create Server in (must not be used together with datacenter). # default: omit location: hel1 # Name of Datacenter to create Server in (must not be used together with location). # default: omit datacenter: null # 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 ``` -------------------------------- ### Enable Molecule Debugging Environment Variables Source: https://github.com/ansible-community/molecule-hetznercloud/blob/main/README.md These environment variables control the verbosity of Molecule's output, aiding in initial debugging. `MOLECULE_NO_LOG=False` provides less verbose output, while `MOLECULE_DEBUG=True` offers very verbose logging for in-depth troubleshooting. ```bash $ export MOLECULE_NO_LOG=False # not so verbose, helpful $ export MOLECULE_DEBUG=True # very verbose, last ditch effort ``` -------------------------------- ### Set Hetzner Cloud API Token Environment Variable Source: https://github.com/ansible-community/molecule-hetznercloud/blob/main/README.md Before interacting with the Hetzner Cloud API, you must expose your `HCLOUD_TOKEN`. This token is essential for authentication and can be obtained from the Hetzner Cloud authentication documentation. ```bash $ export HCLOUD_TOKEN="set_the_hcloud_token_here" ``` -------------------------------- ### Upgrade Molecule Hetzner Cloud Driver Source: https://github.com/ansible-community/molecule-hetznercloud/blob/main/README.md This command upgrades the Molecule Hetzner Cloud driver to its latest version using pip. It ensures you have the most recent features and bug fixes, adhering to Semantic Versioning. ```bash $ pip install --upgrade molecule-hetznercloud ``` -------------------------------- ### Define Custom Molecule Resource Namespace Source: https://github.com/ansible-community/molecule-hetznercloud/blob/main/README.md This environment variable allows defining a custom namespace for resources created by Molecule, which is particularly useful in CI/CD workflows. It helps in isolating resources and preventing naming conflicts across different runs. ```bash $ export RESOURCE_NAMESPACE=e121dc64ff615ccdfac71bb5c00296b9 # Ensure the value length is <= 32 ``` -------------------------------- ### Add Required Volume Name in molecule.yml (v2 Upgrade) Source: https://github.com/ansible-community/molecule-hetznercloud/blob/main/README.md For v2, the `name` field for volumes within `platforms[].volumes[]` in `molecule.yml` is now mandatory. This patch illustrates how to add a `name` field to an existing volume definition. ```patch platforms: - name: instance-1 image: debian-12 volumes: - - size: 20 + - name: volume-1 + size: 20 ``` -------------------------------- ### Remove Default Server Type in molecule.yml (v2 Upgrade) Source: https://github.com/ansible-community/molecule-hetznercloud/blob/main/README.md In v2, the `platforms[].server_type` field in `molecule.yml` now defaults to `cx22`. If your configuration already uses `cx22`, this field can be safely removed to simplify the configuration. ```patch platforms: - name: instance-1 image: debian-12 - server_type: cx22 ``` -------------------------------- ### Update Molecule Driver Name in molecule.yml (v2 Upgrade) Source: https://github.com/ansible-community/molecule-hetznercloud/blob/main/README.md When upgrading to v2, the driver name in `molecule.yml` must be updated from `hetznercloud` to `molecule_hetznercloud`. This patch shows the required change for the `driver.name` field. ```patch driver: - name: hetznercloud + name: molecule_hetznercloud ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.