← 返回首页
GitHub - robertdebock/molecule-action: Test Ansible roles using Molecule · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

robertdebock/molecule-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
 master
Go to file
Code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

117 Commits
 
 
 
 
 
 
 
 
 
 
 
 
View all files

Repository files navigation

More items

Molecule action

A GitHub action to test your Ansible role using Molecule.

Requirements

This action can work with Molecule scenarios that use the docker driver.

This action expects the following (default Ansible role) structure:

. ├── 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 you are missing the molecule directory, please have a look at this skeleton role or one of the many examples listed on my website.

When tox.ini is found, tox is used to test the role. Tox will install all dependecies found in tox.ini itself, meaning tox.ini determines the version of molecule that is used.

Inputs

namespace

The Docker Hub namespace where the image is in. Default "robertdebock".

image

The image you want to run on. Default "fedora".

tag

The tag of the container image to use. Default "latest".

options

The options to pass to 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"

Example usage

Here is a default configuration that tests your role on namespace: robertdebock, image: fedora, tag: latest.

--- on: - push jobs: build: runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v3 with: path: "${{ github.repository }}" - name: molecule uses: robertdebock/molecule-action@6.0.0

NOTE: the checkout action needs to place the file in ${{ github.repository }} in order for Molecule to find your role.

If you want to test your role against multiple distributions, you can use this pattern:

--- name: CI on: - push jobs: lint: runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v3 with: path: "${{ github.repository }}" - name: molecule uses: robertdebock/molecule-action@6.0.0 with: command: lint test: needs: - lint runs-on: ubuntu-20.04 strategy: matrix: image: - alpine - amazonlinux - debian - centos - fedora - opensuse - ubuntu steps: - name: checkout uses: actions/checkout@v3 with: path: "${{ github.repository }}" - name: molecule uses: robertdebock/molecule-action@6.0.0 with: image: "${{ matrix.image }}" options: parallel scenario: my_specific_scenario

Debugging

You can enable Molecule debugging by using this pattern:

# Stuff omitted. - name: molecule uses: robertdebock/molecule-action@6.0.0 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} command: "--debug test"

About

Test Ansible roles using Molecule

Resources

License

Stars

57 stars

Watchers

3 watching

Forks

Packages

 
 
 

Contributors

Footer

© 2026 GitHub, Inc.