Skip to content

Template to create molecule roles with documentation and two scenarios based on vagrant and docker

License

Notifications You must be signed in to change notification settings

mike-wazowski007/ansible-Molecule-cookiecutter

Repository files navigation

Contributors Forks Stargazers Issues GPL3 License LinkedIn Ask Me Anything


Logo

Molecule Cookiecutter Template

This is a template to be used with cookiecuter to create a molecule role
Explore the docs »
Report Bug · Request Feature

Table of Contents

About The Project

Molecule CookieCutter Template

Built With

  • Cookiecutter
  • Molecule
  • Python
  • YAML
  • Ansible
  • JSON
  • Docker

Getting Started

Prerequisites

  • cookiecutter
  • pre-commit
  • molecule-vagrant
  • molecule-docker
  • Vagrant
  • Docker

Installation

Install them doing pip install cookiecutter pre-commit molecule-vagrant molecule-docker


Usage

To initialize the role with cookiecuter

$ pip install cookiecutter pre-commit

$ cookiecutter gh:stiliajohny/ansible-molecule-cookiecutter

To initialize the role with molecule

$ pip install molecule pre-commit

$ molecule init template --url https://github.com/stiliajohny/ansible-molecule-cookiecutter

To test the default scenario docker

$ molecule test

To test the scenario with vagrant

$ molecule test -s vagrant


What this template provides?

  • Initialize a new git repo in the local machine
  • Add .yamllint config file (used by molecule)
  • Add .pre-commit-config.yaml used by pre-commit
  • Add .gitignore with common files I don't want to track in git
  • Add configuration for Molecule in the "molecule" folder
    • default molecule scenario runs on docker
    • There is another molecule scenario using Vagrant
    • The vagrant scenario requires pip install molecule-vagrant
  • Add a travis or Gitlab-CI config file (Optional. By default it's not added)
  • Populates, variables, tasks, handlers on demand
  • Checks role name validity

Directory structure

ansible-role-example/
├── defaults
│   └── main.yml
├── .gitignore
├── handlers
│   └── main.yml
├── meta
│   └── main.yml
├── molecule
│   ├── default
│   │   ├── converge.yml
│   │   ├── INSTALL.rst
│   │   ├── molecule.yml
│   │   └── verify.yml
│   └── vagrant
│       ├── converge.yml
│       ├── INSTALL.rst
│       ├── molecule.yml
│       └── verify.yml
├── .pre-commit-config.yaml
├── README.md
├── tasks
│   └── main.yml
├── vars
│   └── main.yml
└── .yamllint

Roadmap

See the open issues for a list of proposed features (and known issues).


Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the GPL-3.0 License. See LICENSE for more information.

Contact

John Stilia - @john_stilia - stilia.johny@gmail.com


Acknowledgements

https://img.shields.io/github/license/othneildrew/Best-README-Template.svg?style=for-the-badge https://img.shields.io/github/license/stiliajohny/Repo-Template.svg?style=for-the-badge

About

Template to create molecule roles with documentation and two scenarios based on vagrant and docker

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages