Role Developemnt
Prerequisites
Create New Role
Add role as submodule
Always add roles from repository root as submodules.
git submodule add https://github.com/{USER}/{REPO} roles/{ROLE}
Reference:
Create role template files (optional)
Ansible galaxy will overwrite GIT metadata when run directly on the submodule. Instead write a skeleton role and copy data in as-needed. See existing roles.
ansible-galaxy role init --init-path /tmp example
Reference:
.gitignore
.ansible/
.ansible
molecule/cache
Reference:
Update and Commit
Role must be committed to the repository before a new commit hash can be stored for the collection.
cd roles/{ROLE}
git add .
git commit
git push
git submodule update --init # Update submodule commit hash reference.
cd {COLLECTION}
git add roles/{ROLE} # Add updated submodule from collection root.
Reference: