ansible.cfg Cheat Sheet¶
Search Order (Highest to Lowest)¶
ANSIBLE_CONFIGenv var./ansible.cfg~/.ansible.cfg/etc/ansible/ansible.cfg
CLI flag > environment variable (ANSIBLE_*) > ansible.cfg value > built-in default.
A Practical Starting Point¶
[defaults]
inventory = inventories/dev ; safe default; pass production with -i
remote_user = deploy
forks = 20
interpreter_python = auto_silent
callback_result_format = yaml
host_key_checking = True
force_handlers = True
retry_files_enabled = False
[ssh_connection]
pipelining = True
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=accept-new
control_path_dir = ~/.ansible/cp
[privilege_escalation]
become_method = sudo ; opt in per play/task with become: true
Related¶
Full explanation: ansible.cfg · Performance