This repo aimed at testing Ansible Galaxy roles locally before publishing to Ansible Galaxy
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
-
Before you start please read these
-
Create a new repo with README in github
-
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
- 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
-
Update role config in temp folder
-
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
-
Manually move updated molecule config into the sumbodule and commit
-
Run
molecule test
to full process works, if it does not don't bother committing.
Sub folder with your new role will be created.
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