CertGrid CertGrid
Hands-on Lab·Ansible

Ansible Playbooks in Git

add, commit, push is three commands. The part specific to Ansible is what must never go in: a .vault_pass file committed once is in the history for good, and git check-ignore -v is how you prove a rule actually covers it before you find out the hard way.

Templates, Files and Vault Guide 23 of 45 Beginner

git check-ignore -v prints the file, line number and pattern that matched. It is the only way to be certain which rule is doing the work when a .gitignore has several that could.

The control node, and ANS-B01 holding the bare repository from the cloning guide.
Server NameIP AddressOSRolesCPURAMHDD
ANS-CTL01192.168.0.36Ubuntu 26.04 LTSAnsible Control Node2 Core3 GB50 GB
ANS-B01192.168.0.38Ubuntu 26.04 LTSManaged Node (group: db)2 Core3 GB50 GB

This guide includes

Use this when playbooks have to live in Git. This matters because add, commit and push are only three commands - and the files that must never be committed are the part worth being deliberate about.

Before you start

  1. The configuration this guide assumes

  2. Stage and commit

  3. The files that must never be committed

  4. Push it

  5. Change, review, commit

Official sources