Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iamenr0s/molecule-action
This GitHub action is designed to test your Ansible role using Molecule.
https://github.com/iamenr0s/molecule-action
ansible ansible-role ci molecule test-automation
Last synced: 16 days ago
JSON representation
This GitHub action is designed to test your Ansible role using Molecule.
- Host: GitHub
- URL: https://github.com/iamenr0s/molecule-action
- Owner: iamenr0s
- License: mit
- Created: 2024-05-08T13:26:05.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-05-08T16:38:23.000Z (8 months ago)
- Last Synced: 2024-10-30T23:40:33.997Z (2 months ago)
- Topics: ansible, ansible-role, ci, molecule, test-automation
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Molecule Action
This GitHub action is designed to test your Ansible role using Molecule.
Inspired by @robertdebock's [molecule-action](https://github.com/robertdebock/molecule-action/).
## Requirements
This action is compatible with Molecule scenarios employing the podman driver.
For optimal functionality, this action assumes the following structure for your Ansible role (default configuration):
```
.
├── defaults
│ └── main.yml
├── handlers
│ └── main.yml
├── meta
│ └── main.yml
├── molecule
│ └── default
│ ├── molecule.yml
│ ├── playbook.yml
│ └── prepare.yml
├── requirements.yml
├── tasks
│ └── main.yml
├── tox.ini # OPTIONAL
└── vars
└── main.yml
```
If a tox.ini file is present, the role is tested using tox. Tox automatically installs all dependencies specified within the tox.ini file, thus determining the version of molecule utilized.## Inputs
### `namespace`
The Docker Hub namespace where the image is in. Default `"iamenr0s"`.
### `image`
The image you want to run on. Default `"almalinux9"`.
### `tag`
The tag of the container image to use. Default `"latest"`.
### `options`
The [options to pass to `tox`](https://tox.readthedocs.io/en/latest/config.html#tox). For example `parallel`. Default `""`. (empty)
### `command`
The molecule command to use. For example `create`. Default `"test"`.
### `scenario`
The molecule scenario to run. Default `"default"`
## Dependencies
None.
## Example Playbook
```yaml
---
on:
- pushjobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
path: "${{ github.repository }}"
- name: molecule
uses: iamenr0s/molecule-action@main
```> NOTE: Please ensure that the checkout action places the file in ${{ github.repository }} for molecule to locate your role correctly.
To test your role against multiple distributions, you can follow this pattern:"
```yaml
---
name: Role-CIon:
- pushjobs:
yamllint:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
path: "${{ github.repository }}"
- name: yamllint
uses: ibiqlik/[email protected]
with:
config_data: |
extends: default
rules:
new-line-at-end-of-file:
level: warning
trailing-spaces:
level: warning
line-length:
level: warning
test:
needs:
- yamllint
runs-on: ubuntu-latest
strategy:
matrix:
image:
- alpine
- amazonlinux
- debian
- centos
- fedora
- opensuse
- ubuntu
steps:
- name: checkout
uses: actions/checkout@v4
with:
path: "${{ github.repository }}"
- name: molecule
uses: iamenr0s/molecule-action@main
with:
image: "${{ matrix.image }}"
options: parallel
scenario: default
```## License
This project is licensed under the MIT License.
## Author Information