What is Ansible roles ?
Ansible roles are used to break the Ansible playbooks into multiple files. Usually an Ansible developer may have a tendency to write large single playbooks that adds complexity and that is when Ansible roles would come into real help.
Ansible molecules are used to create the ansible roles.
How to install Ansible Molecule:pip install molecule
How to verify the molecule version:$ molecule –version result : molecule, version 2.19.0
What is Ansible galaxy?
Ansible galaxy is site where the ansible developers collaborate to share ansible roles via installing roles, managing roles etc.
How to Initialize a role using Molecule ?Molecule could init a role. The init command can internally access Ansible galaxy. So molecule can generate a directory which has a directory with default as name. Inside that default directory, test build and run can be performed using docker container.Molecule.yml will have all test scenarios like how to lint and test the roles and playbook.yml is used to test the roles.