Role Development
New Role
Ansible galaxy will overwrite GIT metadata when run directly on the submodule
Instead write a skeleton role and copy data in as-needed. See example.
ansible-galaxy role init --init-path /tmp example
Tip
Always add roles from repository root as submodules.
git submodule add https://github.com/{USER}/{REPO} roles/{ROLE}
.gitignore
0644 {USER}:{USER}
# Ansible
.ansible/
.ansible
.vscode/
molecule/cache
COMMIT.md
TODO.md
Redirect ansible caches.
Commits
Role must be committed before a new commit hash can be stored in the collection.
# Standard git commit example.
cd roles/{ROLE}
git add .
git commit
git push
# Update submodule commit hash reference. This does not overwrite repo state.
git submodule update --init
# Add updated submodule from collection root.
cd {COLLECTION}
git add roles/{ROLE}