Skip to content

Instantly share code, notes, and snippets.

@wbcurry
Forked from anonymous/.ansible.cfg
Last active November 19, 2024 07:28
Show Gist options
  • Save wbcurry/f38bc6d8d1ee4a70ee2c to your computer and use it in GitHub Desktop.
Save wbcurry/f38bc6d8d1ee4a70ee2c to your computer and use it in GitHub Desktop.
Ansible: .ansible.cfg
# config file for ansible -- http://ansible.com/
# ==============================================
# nearly all parameters can be overridden in ansible-playbook
# or with command line flags. ansible will read ANSIBLE_CONFIG,
# ansible.cfg in the current working directory, .ansible.cfg in
# the home directory or /etc/ansible/ansible.cfg, whichever it
# finds first
[defaults]
# some basic default values...
inventory = $HOME/.ansible/hosts
remote_tmp = $HOME/.ansible/tmp
forks = 150
sudo_user = root
transport = smart
# plays will gather facts by default, which contain information about
# the remote system.
#
# smart - gather by default, but don't regather if already gathered
# implicit - gather by default, turn off with gather_facts: False
# explicit - do not gather by default, must say gather_facts: True
gathering = smart
# additional paths to search for roles in, colon separated
roles_path = $HOME/.ansible/roles
# uncomment this to disable SSH key host checking
host_key_checking = False
# logging is off by default unless this path is defined
# if so defined, consider logrotate
log_path = /var/log/ansible.log
# default module name for /usr/bin/ansible
module_name = shell
# set plugin path directories here, separate with colons
action_plugins = /usr/share/ansible_plugins/action_plugins:$HOME/.ansible/plugins/action_plugins
callback_plugins = /usr/share/ansible_plugins/callback_plugins:$HOME/.ansible/plugins/callback_plugins
connection_plugins = /usr/share/ansible_plugins/connection_plugins:$HOME/.ansible/plugins/connection_plugins
lookup_plugins = /usr/share/ansible_plugins/lookup_plugins:$HOME/.ansible/plugins/lookup_plugins
vars_plugins = /usr/share/ansible_plugins/vars_plugins:$HOME/.ansible/plugins/vars_plugins
filter_plugins = /usr/share/ansible_plugins/filter_plugins:$HOME/.ansible/plugins/filter_plugins
# by default callbacks are not loaded for /bin/ansible, enable this if you
# want, for example, a notification or logging callback to also apply to
# /bin/ansible runs
#bin_ansible_callbacks = False
# the CA certificate path used for validating SSL certs. This path
# should exist on the controlling node, not the target nodes
# common locations:
# RHEL/CentOS: /etc/pki/tls/certs/ca-bundle.crt
# Fedora : /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
# Ubuntu : /usr/share/ca-certificates/cacert.org/cacert.org.crt
ca_file_path = /usr/share/ca-certificates/cacert.org/cacert.org.crt
# if set to a persistent type (not 'memory', for example 'redis') fact values
# from previous runs in Ansible will be stored. This may be useful when
# wanting to use, for example, IP information from one group of servers
# without having to talk to them in the same playbook run to get their
# current IP information.
fact_caching = jsonfile
fact_caching_connection = $HOME/.ansible/facts
fact_caching_timeout = 600
# retry files
#retry_files_enabled = False
retry_files_save_path = ~/.ansible/retry
[privilege_escalation]
#become=True
#become_method=sudo
#become_user=root
#become_ask_pass=False
[ssh_connection]
# ssh arguments to use
# Leaving off ControlPersist will result in poor performance, so use
# paramiko on older platforms rather than removing it
ssh_args = -o ControlMaster=auto -o ControlPersist=60s
# The path to use for the ControlPath sockets. This defaults to
# "%(directory)s/ansible-ssh-%%h-%%p-%%r", however on some systems with
# very long hostnames or very long path names (caused by long user names or
# deeply nested home directories) this can exceed the character limit on
# file socket names (108 characters for most platforms). In that case, you
# may wish to shorten the string below.
#
# Example:
# control_path = %(directory)s/%%h-%%r
control_path = %(directory)s/ansible-ssh-%%h-%%p-%%r
# Enabling pipelining reduces the number of SSH operations required to
# execute a module on the remote server. This can result in a significant
# performance improvement when enabled, however when using "sudo:" you must
# first disable 'requiretty' in /etc/sudoers
#
# By default, this option is disabled to preserve compatibility with
# sudoers configurations that have requiretty (the default on many distros).
#
pipelining = True
# if True, make ansible use scp if the connection type is ssh
# (default is sftp)
scp_if_ssh = True
[accelerate]
accelerate_port = 5099
accelerate_timeout = 30
accelerate_connect_timeout = 5.0
# The daemon timeout is measured in minutes. This time is measured
# from the last activity to the accelerate daemon.
accelerate_daemon_timeout = 30
# If set to yes, accelerate_multi_key will allow multiple
# private keys to be uploaded to it, though each user must
# have access to the system via SSH to add a new key. The default
# is "no".
#accelerate_multi_key = yes
[selinux]
# file systems that require special treatment when dealing with security context
# the default behaviour that copies the existing context or uses the user default
# needs to be changed to use the file system dependent context.
#special_context_filesystems=nfs,vboxsf,fuse,ramfs
@Bentouhami
Copy link

Hello, when i type : nano /etc/ansible/ansible.cfg
i get:
GNU nano 7.2 /etc/ansible/ansible.cfg

Since Ansible 2.12 (core):

To generate an example config file (a "disabled" one with all default settings, commented out):

$ ansible-config init --disabled > ansible.cfg

Also you can now have a more complete file by including existing plugins:

ansible-config init --disabled -t all > ansible.cfg

For previous versions of Ansible, you can check for examples in the 'stable' branches of each version

Note that this file was always incomplete and lagging changes to configuration settings

for example, for 2.9: https://github.com/ansible/ansible/blob/stable-2.9/examples/ansible.cfg

Is this normal? And how can I get the default one commented?
I tried the commands in Ansible docs, but nothing changes !
$ ansible-config init --disabled > ansible.cfg
and this one too:

$ ansible-config init --disabled -t all > ansible.cfg

what should i do?
thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment