What is Ansible Molecule and how to install Ansible Molecule ?
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,
dependency:
name: this can be galaxy or Shell or Gilt
driver:
name: this can be docker, cloud like Azure, EC2, DigitalOcean etc
linit:
name: this can lint the program. For example ‘yamllint’ for yml playbook files.
platform: this configures driver specific platforms, populates hosts, handle interactions
name:
provisioner: this configures ansible playbooks run.
name: ansible
lint:
name: ansible-lint
verifier: this configures what to run for tests.
name: ansible
lint:
name: ansible-lint
scenario: this configures how test scenario runs…
test_sequence:
-lint
-create
-cleanup
-distroy
-syntax etc