What goes into a project-level `ansible.cfg` for production?
BeginnerProductionProject Structure and Design
Answer
[defaults]
roles_path = roles
collections_path = collections
forks = 20
host_key_checking = True
interpreter_python = auto_silent
callbacks_enabled = ansible.posix.profile_tasks, ansible.posix.timer
retry_files_enabled = False
timeout = 30
[ssh_connection]
pipelining = True
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o ServerAliveInterval=30
Commit it with the project, so CI and developers behave the same. Keep host-specific overrides (private key paths) out of it, using environment variables instead.
More on Project Structure and Design
What does a production Ansible repository look like?BeginnerMonorepo 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?Intermediate