Template for ansible role with molecule testing
The template itself only needs python, cookicuter and pre-commit. Install them doing pip install cookiecutter pre-commit
- 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 + centos7/systemd image
- There is another molecule scenario using Vagrant + bento/centos-7 box (1 core - 1GB ram - selinux=permissive)
- molecule runs testinfra in verbose mode
- the role is executed with become: true (everything is executed as root/sudo)
- Add a travis or Gitlab-CI config file (Optional. By default it's not added)
- And probably something else that I forget... :)
$ pip install cookiecutter pre-commit
$ cookiecutter gh:pescobar/cookiecutter-ansible-role-molecule
$ pip install molecule pre-commit
$ molecule init template --url https://github.com/pescobar/cookiecutter-ansible-role-molecule
$ molecule test
$ molecule test -s vagrant
role_name/
├── defaults
│ └── main.yml
├── .gitignore
├── .gitlab-ci.yml
├── handlers
│ └── main.yml
├── meta
│ └── main.yml
├── molecule
│ ├── default
│ │ ├── Dockerfile.j2
│ │ ├── INSTALL.rst
│ │ ├── molecule.yml
│ │ └── playbook.yml
│ ├── tests
│ │ └── test_default.py
│ └── vagrant
│ ├── INSTALL.rst
│ ├── molecule.yml
│ ├── playbook.yml
│ └── prepare.yml
├── .pre-commit-config.yaml
├── README.md
├── tasks
│ └── main.yml
├── .travis.yml
├── vars
│ └── main.yml
└── .yamllint