Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dbrennand/molecule-demo
This repository is a demo of how to use Molecule to test an Ansible playbook.
https://github.com/dbrennand/molecule-demo
ansible ansible-playbook molecule testing
Last synced: 23 days ago
JSON representation
This repository is a demo of how to use Molecule to test an Ansible playbook.
- Host: GitHub
- URL: https://github.com/dbrennand/molecule-demo
- Owner: dbrennand
- License: mit
- Created: 2023-08-01T16:16:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-02T07:39:37.000Z (over 1 year ago)
- Last Synced: 2024-11-30T22:47:11.073Z (23 days ago)
- Topics: ansible, ansible-playbook, molecule, testing
- Homepage: https://danielbrennand.com/blog/testing-ansible-content
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# molecule-demo
This repository is a demo of how to use [Molecule](https://molecule.readthedocs.io/en/latest/) to test an Ansible playbook.
This repository complements my blog post [Testing Ansible Content with Molecule](https://danielbrennand.com/blog/testing-ansible-content).
The [playbook](playbook.yml) in this repository installs [Nginx](https://www.nginx.com/). The [default](molecule/default) molecule scenario tests the playbook against a Debian container instance. The Docker driver is used to create the instance.
## Requirements
- Python >= 3.11
- Docker >= 24.0.5## Usage
1. Create the Python virtual environment and install the dependencies:
```bash
mkdir -pv ~/.virtualenvs
python3 -m venv ~/.virtualenvs/molecule-demo
source ~/.virtualenvs/molecule-demo/bin/activate
pip install -r requirements.txt
```2. Run the full test sequence with Molecule:
```bash
molecule test
```