Metadata-Version: 2.1
Name: molecule-hetznercloud
Version: 0.2.1
Summary: Molecule Hetzner Cloud Plugin :: run molecule tests with hetzner cloud
Home-page: https://git.autonomic.zone/autonomic-cooperative/molecule-hetznercloud
Author: decentral1se
Author-email: lukewm@riseup.net
Maintainer: decentral1se
Maintainer-email: lukewm@riseup.net
License: LGPL
Project-URL: Bug Tracker, https://git.autonomic.zone/autonomic-cooperative/molecule-hetznercloud/issues
Project-URL: CI: Drone, https://drone.autonomic.zone/autonomic-cooperative/molecule-hetznercloud/
Project-URL: Source Code, https://git.autonomic.zone/autonomic-cooperative/molecule-hetznercloud
Keywords: ansible,hetznercloud,molecule,plugin,roles,testing,verifier
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Utilities
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: hcloud (<2,>=1.6.3)
Requires-Dist: molecule (<=3.1,>=3.0.4)
Requires-Dist: pyyaml (<6,>=5.3.1)
Provides-Extra: test
Requires-Dist: hcloud (<2,>=1.6.3) ; extra == 'test'
Requires-Dist: mock (<5,>=4.0.2) ; extra == 'test'
Requires-Dist: pytest-cov (<3,>=2.8.1) ; extra == 'test'
Requires-Dist: pytest-helpers-namespace (<2020,>=2019.1.8) ; extra == 'test'
Requires-Dist: pytest-mock (<4,>=3.1.0) ; extra == 'test'
Requires-Dist: pytest-verbose-parametrize (<2,>=1.7.0) ; extra == 'test'
Requires-Dist: pytest-xdist (<2,>=1.31.0) ; extra == 'test'
Requires-Dist: pytest (<6,>=5.4.1) ; extra == 'test'

# Molecule Hetzner Cloud Plugin

[![Drone CI-CD](https://drone.autonomic.zone/api/badges/autonomic-cooperative/molecule-hetznercloud/status.svg)](https://drone.autonomic.zone/autonomic-cooperative/molecule-hetznercloud)
[![PyPI Package](https://badge.fury.io/py/molecule-hetznercloud.svg)](https://badge.fury.io/py/molecule-hetznercloud)
[![Repository License](https://img.shields.io/badge/license-LGPL-brightgreen.svg)](LICENSE)

A [Hetzner Cloud](https://www.hetzner.com/cloud) plugin for [Molecule](https://molecule.readthedocs.io/en/latest/).

This plugin allows you to do `molecule init role myrolename -d hetznercloud`
and have Molecule provision on-demand Hetzner Cloud VPSes of your choice for
your integration testing. New VPSes will be automagically created and
provisioned on each `molecule test` run, SSH keys are generated and managed
internally and all resources are cleaned up regardless of whether the role
under test succeeds or fails.

## Support

If you use this plugin in a commercial setting or you find it personally
useful, please support my maintenance work financially through my
[Liberapay](https://liberapay.com/decentral1se/) profile or through my [Github
Sponsor profile](https://github.com/sponsors/decentral1se). I do not receive
any financial support from RedHat or Hetzner Cloud for this work.

## Usage

You need to expose a `HCLOUD_TOKEN` environment variable in your environment.

Find out more about how to get one of those [over here](https://docs.hetzner.cloud/#overview-authentication).

```bash
$ export HCLOUD_TOKEN=mycoolapitoken
```

Then install the required Python package.

```bash
$ pip install molecule-hetznercloud
$ molecule init role myrolename -d hetznercloud
```

Your `myrolename/molecule/default/molecule.yml` should then look like the following.

```yaml
---
dependency:
  name: galaxy
driver:
  name: hetznercloud
platforms:
  - name: instance
    server_type: cx11
    image: debian-10
provisioner:
  name: ansible
verifier:
  name: ansible
```

Please see [docs.hetzner.cloud](https://docs.hetzner.cloud/) for information regarding images and server types.

Then just run the role.

```bash
$ cd myrolename && molecule test
```

To ease initial debugging for getting things started, also expose the following
environment variables.

```bash
$ export MOLECULE_NO_LOG=False  # not so verbose, helpful
$ export MOLECULE_DEBUG=True  # very verbose, last ditch effort
```

## Only use `molecule.yml` for configuration

It is being worked on that it is possible to remove all the files except the
`molecule.yml` scenario file in your scenario directory. This is useful when
you only require this plugin to do the default behaviour each time. It is also
useful to reduce maintenance effort for migration of configurations. This
plugin currently embeds the `create.yml` and `destroy.yml` playbooks. All other
playbooks (e.g. prepare, cleanup) can be created as needed and Molecule will
pick them up and run them. Embedding the `converge.yml` awaits [this feature
request](https://github.com/ansible-community/molecule/issues/2675).

## Mirroring

Issues will be responded to on both issue trackers.

- [git.autonomic.zone](https://git.autonomic.zone/autonomic-cooperative/molecule-hetznercloud) (primary)
- [github.com](https://github.com/ansible-community/molecule-hetznercloud) (mirror)

## Change log

See [CHANGELOG.md](./CHANGELOG.md).

## Molecule Documentation

> https://molecule.readthedocs.io

## Contact

- Ping @decentral1se on the `#ansible-molecule` channel on [Freenode](https://webchat.freenode.net).

## License

The [LGPLv3](https://www.gnu.org/licenses/lgpl-3.0.en.html) license.

## Testing

This is all done on our [drone.autonomic.zone](https://drone.autonomic.zone/autonomic-cooperative/molecule-hetznercloud) setup.

### Unit

```bash
$ pip install tox
$ tox -v
```

### Integration

Only doable by [Autonomic Cooperative](https://autonomic.zone/) members.

```bash
$ sudo apt install -y direnv
$ cp .envrc.sample .envrc
$ direnv allow
$ pip install -e .
$ cd integration-test-role && molecule test
```


