/aemdesign-ansible-roles

parent project for all ansible roles

Primary LanguageShellApache License 2.0Apache-2.0

AEM.Design - Ansible Roles

build_status github license github issues github last commit github repo size

This repo aimed at testing Ansible Galaxy roles locally before publishing to Ansible Galaxy

Cloning

This repo links all roles using git submodules. When cloning this repo you need to use the --recursive flag to tell git to pull all the submodules.

git clone --recursive git@github.com:aem-design/aemdesign-ansible-roles.git

Migrating old module to Molecule v2

  1. Before you start please read these

  2. Create a new repo with README in github

  3. add new repo as submodule to the project

git submodule add git@github.com:aem-design/ansible-role-aem-toughday.git roles/ansible-role-aem-toughday
  1. Use molecule to init the new module
cd roles/tmp
workon aemdesign.3.7.4
pip install molecule
molecule init role -r ansible-role-aem-toughday
  1. Update role config in temp folder

  2. Run molecule converge while you are developing the role

molecule converge
<do some work on the role>
molecule converge
<see that some changes didn't work>
molecule lint
<fix all the typos>
molecule converge
<see everything working well, commit my changes>
molecule test
<see everything working well, commit my changes>
molecule converge
<idempotence check - make sure Ansible doesn't report any changes on a second run>
molecule destroy
  1. Manually move updated molecule config into the sumbodule and commit

  2. Run molecule test to full process works, if it does not don't bother committing.

Sub folder with your new role will be created.

Testing

To run molecule tests enter role directory, switch to virtual env and run molecule test

cd roles/ansible-role-aem-verify
workon aemdesign.3.7.2
molecule test