Testing your Ansible roles with Molecule: Ansible molecule project is helpful for Ansible roles development and testing. Ansible molecule have been great help for developing ansible testing framework and scenarios.
How to install Molecule?
python3 -m pip install –user “molecule[lint]”
molecule docker image is also available and is a good alternative way to implement ansible molecule.
Ansible molecule Anatomy:
Below are the Anatomy of Ansible molecule,
name: this can be galaxy or Shell or Gilt
name: this can be docker, cloud like Azure, EC2, DigitalOcean etc
name: this can lint the program. For example ‘yamllint’ for yml playbook files.
platform: this configures driver specific platforms, populates hosts, handle interactions
provisioner: this configures ansible playbooks run.
verifier: this configures what to run for tests.
scenario: this configures how test scenario runs…