What does a production Ansible repository look like?
BeginnerProductionProject Structure and Design
Answer
In production we keep one repo with a predictable layout, so anyone on the team can find things in seconds.
infra-ansible/
ansible.cfg
requirements.yml # pinned collections and roles
inventories/
dev/ { aws_ec2.yml, group_vars/, host_vars/ }
stage/ { ... }
prod/ { ... }
playbooks/
site.yml web.yml db.yml patch.yml deploy.yml
roles/ # our own roles
collections/ # installed deps (git-ignored)
.ansible-lint .yamllint .pre-commit-config.yaml
Environments differ by inventory directory, never by forked copies of playbooks.
More on Project Structure and Design
Monorepo or separate repos for roles? How do you decide?IntermediateHow do you structure inventories for dev, stage and prod?BeginnerHow do you prevent someone from running a playbook against production by accident?IntermediateWhat does "thin playbooks, fat roles" mean?IntermediateWhat makes a well-designed role?IntermediateWhat goes into a project-level `ansible.cfg` for production?Beginner