Editing /etc/ansible/ansible.cfg

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
<code>[[/etc/ansible/]]ansible.cfg</code> and <code>[[~/.ansible.cfg]]</code>
+
  host_key_checking = false
 
 
  [[host_key_checking]] = false
 
 
 
[[pipelining]] = true
 
 
 
[[deprecation_warning]] = false
 
  
 
  inventory = <PATH TO INVENTORY FILE>
 
  inventory = <PATH TO INVENTORY FILE>
Line 11: Line 5:
 
  [[private_key_file]] =  <PATH TO KEY_FILE>
 
  [[private_key_file]] =  <PATH TO KEY_FILE>
  
<code>[[localhost_warning]] = false</code>
 
  
  
Line 30: Line 23:
  
  
== Full /etc/ansible/ansible.cfg ==
 
  
# config file for ansible -- https://ansible.com/
+
<pre>
# ===============================================
+
# config file for ansible -- https://ansible.com/
+
# ===============================================
# nearly all parameters can be overridden in ansible-playbook  
+
 
# or with command line flags. ansible will read ANSIBLE_CONFIG,
+
# nearly all parameters can be overridden in ansible-playbook
# ansible.cfg in the current working directory, .ansible.cfg in
+
# or with command line flags. ansible will read ANSIBLE_CONFIG,
# the home directory or /etc/ansible/ansible.cfg, whichever it
+
# ansible.cfg in the current working directory, .ansible.cfg in
# finds first
+
# the home directory or /etc/ansible/ansible.cfg, whichever it
+
# finds first
[defaults]
+
 
+
[defaults]
# some basic default values...
+
 
+
# some basic default values...
#inventory      = /etc/ansible/hosts  
+
 
#library        = /usr/share/my_modules/
+
#inventory      = /etc/ansible/hosts
#module_utils  = /usr/share/my_module_utils/
+
#library        = /usr/share/my_modules/
#remote_tmp    = ~/.ansible/tmp
+
#module_utils  = /usr/share/my_module_utils/
#local_tmp      = ~/.ansible/tmp
+
#remote_tmp    = ~/.ansible/tmp
#plugin_filters_cfg = /etc/ansible/plugin_filters.yml
+
#local_tmp      = ~/.ansible/tmp
#[[forks]]         = 5
+
#plugin_filters_cfg = /etc/ansible/plugin_filters.yml
#poll_interval  = 15
+
#forks          = 5
#sudo_user      = root
+
#poll_interval  = 15
#ask_sudo_pass = True
+
#sudo_user      = root
#ask_pass      = True
+
#ask_sudo_pass = True
#[[transport]]     = smart
+
#ask_pass      = True
#remote_port    = 22
+
#transport      = smart
#module_lang    = C
+
#remote_port    = 22
#module_set_locale = False
+
#module_lang    = C
+
#module_set_locale = False
# plays will gather facts by default, which contain information about
+
 
# the remote system.
+
# 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
+
# smart - gather by default, but don't regather if already gathered
# explicit - do not gather by default, must say gather_facts: True
+
# implicit - gather by default, turn off with gather_facts: False
#[[gathering]] = implicit
+
# explicit - do not gather by default, must say gather_facts: True
+
#gathering = implicit
# This only affects the gathering done by a play's gather_facts directive,
+
 
# by default gathering retrieves all facts subsets
+
# This only affects the gathering done by a play's gather_facts directive,
# all - gather all subsets
+
# by default gathering retrieves all facts subsets
# network - gather min and network facts
+
# all - gather all subsets
# hardware - gather hardware facts (longest facts to retrieve)
+
# network - gather min and network facts
# virtual - gather min and virtual facts
+
# hardware - gather hardware facts (longest facts to retrieve)
# facter - import facts from facter
+
# virtual - gather min and virtual facts
# ohai - import facts from ohai
+
# facter - import facts from facter
# You can combine them using comma (ex: network,virtual)
+
# ohai - import facts from ohai
# You can negate them using ! (ex: !hardware,!facter,!ohai)
+
# You can combine them using comma (ex: network,virtual)
# A minimal set of facts is always gathered.
+
# You can negate them using ! (ex: !hardware,!facter,!ohai)
#gather_subset = all
+
# A minimal set of facts is always gathered.
 +
#gather_subset = all
  
<pre>
 
 
# some hardware related facts are collected
 
# some hardware related facts are collected
 
# with a maximum timeout of 10 seconds. This
 
# with a maximum timeout of 10 seconds. This
Line 221: Line 213:
 
# instead of shelling out to the git command.
 
# instead of shelling out to the git command.
 
# command_warnings = False
 
# command_warnings = False
</pre>
 
  
# set plugin path directories here, separate with colons
 
#action_plugins    = /usr/share/ansible/plugins/action
 
#become_plugins    = /usr/share/ansible/plugins/become
 
#cache_plugins      = /usr/share/ansible/plugins/cache
 
#callback_plugins  = /usr/share/ansible/plugins/callback
 
#connection_plugins = /usr/share/ansible/plugins/connection
 
#lookup_plugins    = /usr/share/ansible/plugins/lookup
 
#inventory_plugins  = /usr/share/ansible/plugins/inventory
 
#vars_plugins      = /usr/share/ansible/plugins/vars
 
#filter_plugins    = /usr/share/ansible/plugins/filter
 
#test_plugins      = /usr/share/ansible/plugins/test
 
#terminal_plugins  = /usr/share/ansible/plugins/terminal
 
#strategy_plugins  = /usr/share/ansible/plugins/strategy
 
 
 
# by default, ansible will use the 'linear' strategy but you may want to try
 
# another one
 
#[[strategy]] = free
 
 
# 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
 
 
 
# don't like cows?  that's unfortunate.
 
# set to 1 if you don't want cowsay support or export ANSIBLE_NOCOWS=1
 
#nocows = 1
 
 
# set which cowsay stencil you'd like to use by default. When set to 'random',
 
# a random stencil will be selected for each task. The selection will be filtered
 
# against the `cow_whitelist` option below.
 
#cow_selection = default
 
#cow_selection = random
 
 
 
 
# when using the 'random' option for cowsay, stencils will be restricted to this list.
 
# it should be formatted as a comma-separated list with no spaces between names.
 
# NOTE: line continuations here are for formatting purposes only, as the INI parser
 
#      in python does not support them.
 
#cow_whitelist=bud-frogs,bunny,cheese,daemon,default,dragon,elephant-in-snake,elephant,eyes,\
 
#              hellokitty,kitty,luke-koala,meow,milk,moofasa,moose,ren,sheep,small,stegosaurus,\
 
#              stimpy,supermilker,three-eyes,turkey,turtle,tux,udder,vader-koala,vader,www
 
 
# don't like colors either?
 
# set to 1 if you don't want colors, or export ANSIBLE_NOCOLOR=1
 
#nocolor = 1
 
 
# 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 = memory
 
 
#This option tells Ansible where to cache facts. The value is plugin dependent.
 
#For the jsonfile plugin, it should be a path to a local directory.
 
#For the redis plugin, the value is a host:port:database triplet: fact_caching_connection = localhost:6379:0
 
 
#fact_caching_connection=/tmp
 
 
 
 
# retry files
 
# When a playbook fails a .retry file can be created that will be placed in ~/
 
# You can enable this feature by setting retry_files_enabled to True
 
# and you can change the location of the files by setting retry_files_save_path
 
 
#retry_files_enabled = False
 
#retry_files_save_path = ~/.ansible-retry
 
 
# squash actions
 
# Ansible can optimise actions that call modules with list parameters
 
# when looping. Instead of calling the module once per with_ item, the
 
# module is called once with all items at once. Currently this only works
 
# under limited circumstances, and only with parameters named 'name'.
 
#squash_actions = apk,apt,dnf,homebrew,pacman,pkgng,yum,zypper
 
 
# prevents logging of task data, off by default
 
#no_log = False
 
 
# prevents logging of tasks, but only on the targets, data is still logged on the master/controller
 
#no_target_syslog = False
 
  
<pre>
+
# set plugin path directories here, separate with colons
 +
#action_plugins    = /usr/share/ansible/plugins/action
 +
#become_plugins    = /usr/share/ansible/plugins/become
 +
#cache_plugins      = /usr/share/ansible/plugins/cache
 +
#callback_plugins  = /usr/share/ansible/plugins/callback
 +
#connection_plugins = /usr/share/ansible/plugins/connection
 +
#lookup_plugins    = /usr/share/ansible/plugins/lookup
 +
#inventory_plugins  = /usr/share/ansible/plugins/inventory
 +
#vars_plugins      = /usr/share/ansible/plugins/vars
 +
#filter_plugins    = /usr/share/ansible/plugins/filter
 +
#test_plugins      = /usr/share/ansible/plugins/test
 +
#terminal_plugins  = /usr/share/ansible/plugins/terminal
 +
#strategy_plugins  = /usr/share/ansible/plugins/strategy
 +
 
 +
 
 +
# by default, ansible will use the 'linear' strategy but you may want to try
 +
# another one
 +
#strategy = free
 +
 
 +
# 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
 +
 
 +
 
 +
# don't like cows?  that's unfortunate.
 +
# set to 1 if you don't want cowsay support or export ANSIBLE_NOCOWS=1
 +
#nocows = 1
 +
 
 +
# set which cowsay stencil you'd like to use by default. When set to 'random',
 +
# a random stencil will be selected for each task. The selection will be filtered
 +
# against the `cow_whitelist` option below.
 +
#cow_selection = default
 +
#cow_selection = random
 +
 
 +
# when using the 'random' option for cowsay, stencils will be restricted to this list.
 +
# it should be formatted as a comma-separated list with no spaces between names.
 +
# NOTE: line continuations here are for formatting purposes only, as the INI parser
 +
#      in python does not support them.
 +
#cow_whitelist=bud-frogs,bunny,cheese,daemon,default,dragon,elephant-in-snake,elephant,eyes,\
 +
#              hellokitty,kitty,luke-koala,meow,milk,moofasa,moose,ren,sheep,small,stegosaurus,\
 +
#              stimpy,supermilker,three-eyes,turkey,turtle,tux,udder,vader-koala,vader,www
 +
 
 +
# don't like colors either?
 +
# set to 1 if you don't want colors, or export ANSIBLE_NOCOLOR=1
 +
#nocolor = 1
 +
 
 +
# 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 = memory
 +
 
 +
#This option tells Ansible where to cache facts. The value is plugin dependent.
 +
#For the jsonfile plugin, it should be a path to a local directory.
 +
#For the redis plugin, the value is a host:port:database triplet: fact_caching_connection = localhost:6379:0
 +
 
 +
#fact_caching_connection=/tmp
 +
 
 +
 
 +
 
 +
# retry files
 +
# When a playbook fails a .retry file can be created that will be placed in ~/
 +
# You can enable this feature by setting retry_files_enabled to True
 +
# and you can change the location of the files by setting retry_files_save_path
 +
 
 +
#retry_files_enabled = False
 +
#retry_files_save_path = ~/.ansible-retry
 +
 
 +
# squash actions
 +
# Ansible can optimise actions that call modules with list parameters
 +
# when looping. Instead of calling the module once per with_ item, the
 +
# module is called once with all items at once. Currently this only works
 +
# under limited circumstances, and only with parameters named 'name'.
 +
#squash_actions = apk,apt,dnf,homebrew,pacman,pkgng,yum,zypper
 +
 
 +
# prevents logging of task data, off by default
 +
#no_log = False
 +
 
 +
# prevents logging of tasks, but only on the targets, data is still logged on the master/controller
 +
#no_target_syslog = False
 +
 
 
# controls whether Ansible will raise an error or warning if a task has no
 
# controls whether Ansible will raise an error or warning if a task has no
 
# choice but to create world readable temporary files to execute a module on
 
# choice but to create world readable temporary files to execute a module on
Line 380: Line 370:
 
#become_ask_pass=False
 
#become_ask_pass=False
  
</pre>
+
[paramiko_connection]
 +
 
 +
# uncomment this line to cause the paramiko connection plugin to not record new host
 +
# keys encountered.  Increases performance on new host additions.  Setting works independently of the
 +
# host key checking setting above.
 +
#record_host_keys=False
 +
 
 +
# by default, Ansible requests a pseudo-terminal for commands executed under sudo. Uncomment this
 +
# line to disable this behaviour.
 +
#pty=False
 +
 
 +
# paramiko will default to looking for SSH keys initially when trying to
 +
# authenticate to remote devices.  This is a problem for some network devices
 +
# that close the connection after a key failure.  Uncomment this line to
 +
# disable the Paramiko look for keys function
 +
#look_for_keys = False
 +
 
 +
# When using persistent connections with Paramiko, the connection runs in a
 +
# background process.  If the host doesn't already have a valid SSH key, by
 +
# default Ansible will prompt to add the host key.  This will cause connections
 +
# running in background processes to fail.  Uncomment this line to have
 +
# Paramiko automatically add host keys.
 +
#host_key_auto_add = True
 +
 
 +
[ssh_connection]
 +
 
 +
# ssh arguments to use
 +
# Leaving off ControlPersist will result in poor performance, so use
 +
# paramiko on older platforms rather than removing it, -C controls compression use
 +
#ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s
 +
 
 +
# The base directory for the ControlPath sockets.
 +
# This is the "%(directory)s" in the control_path option
 +
#
 +
# Example:
 +
# control_path_dir = /tmp/.ansible/cp
 +
#control_path_dir = ~/.ansible/cp
 +
 
 +
# The path to use for the ControlPath sockets. This defaults to a hashed string of the hostname,
 +
# port and username (empty string in the config). The hash mitigates a common problem users
 +
# found with long hostnames and the conventional %(directory)s/ansible-ssh-%%h-%%p-%%r format.
 +
# In those cases, a "too long for Unix domain socket" ssh error would occur.
 +
#
 +
# Example:
 +
# control_path = %(directory)s/%%h-%%r
 +
#control_path =
 +
 
 +
# 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 = False
 +
 
 +
# Control the mechanism for transferring files (old)
 +
#  * smart = try sftp and then try scp [default]
 +
#  * True = use scp only
 +
#  * False = use sftp only
 +
#scp_if_ssh = smart
  
[paramiko_connection]
+
# Control the mechanism for transferring files (new)
+
# If set, this will override the scp_if_ssh option
# uncomment this line to cause the paramiko connection plugin to not record new host
+
#   * sftp = use sftp to transfer files
# keys encountered. Increases performance on new host additions.  Setting works independently of the
+
#   * scp  = use scp to transfer files
# host key checking setting above.
+
#   * piped = use 'dd' over SSH to transfer files
#record_host_keys=False
+
#   * smart = try sftp, scp, and piped, in that order [default]
+
#transfer_method = smart
# by default, Ansible requests a pseudo-terminal for commands executed under sudo. Uncomment this
 
# line to disable this behaviour.
 
#pty=False
 
  
# paramiko will default to looking for SSH keys initially when trying to
+
# if False, sftp will not use batch mode to transfer files. This may cause some
# authenticate to remote devices.  This is a problem for some network devices
+
# types of file transfer failures impossible to catch however, and should
# that close the connection after a key failure.  Uncomment this line to
+
# only be disabled if your sftp version has problems with batch mode
# disable the Paramiko look for keys function
+
#sftp_batch_mode = False
#look_for_keys = False
 
 
# When using persistent connections with Paramiko, the connection runs in a
 
# background process.  If the host doesn't already have a valid SSH key, by
 
# default Ansible will prompt to add the host key. This will cause connections
 
# running in background processes to fail.  Uncomment this line to have
 
# Paramiko automatically add host keys.
 
#host_key_auto_add = True
 
 
[ssh_connection]
 
 
# ssh arguments to use
 
# Leaving off ControlPersist will result in poor performance, so use
 
# paramiko on older platforms rather than removing it, -C controls compression use
 
#[[ssh_args]] = -C -o ControlMaster=auto -o ControlPersist=60s
 
 
# The base directory for the ControlPath sockets.
 
# This is the "%(directory)s" in the control_path option
 
#
 
# Example:
 
# control_path_dir = /tmp/.ansible/cp
 
#control_path_dir = ~/.ansible/cp
 
 
# The path to use for the ControlPath sockets. This defaults to a hashed string of the hostname,
 
# port and username (empty string in the config). The hash mitigates a common problem users
 
# found with long hostnames and the conventional %(directory)s/ansible-ssh-%%h-%%p-%%r format.
 
# In those cases, a "too long for Unix domain socket" ssh error would occur.
 
#
 
# Example:
 
# control_path = %(directory)s/%%h-%%r
 
#control_path =
 
  
# Enabling pipelining reduces the number of SSH operations required to
+
# The -tt argument is passed to ssh when pipelining is not enabled because sudo
# execute a module on the remote server. This can result in a significant
+
# requires a tty by default.
# performance improvement when enabled, however when using "sudo:" you must
+
#usetty = True
# 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]] = False
 
  
 +
# Number of times to retry an SSH connection to a host, in case of UNREACHABLE.
 +
# For each retry attempt, there is an exponential backoff,
 +
# so after the first attempt there is 1s wait, then 2s, 4s etc. up to 30s (max).
 +
#retries = 3
  
# Control the mechanism for transferring files (old)
+
[persistent_connection]
#  * smart = try sftp and then try scp [default]
 
#  * True = use scp only
 
#  * False = use sftp only
 
#scp_if_ssh = smart
 
 
# Control the mechanism for transferring files (new)
 
# If set, this will override the scp_if_ssh option
 
#  * sftp  = use sftp to transfer files
 
#  * scp  = use scp to transfer files
 
#  * piped = use 'dd' over SSH to transfer files
 
#  * smart = try sftp, scp, and piped, in that order [default]
 
#transfer_method = smart
 
 
# if False, sftp will not use batch mode to transfer files. This may cause some
 
# types of file transfer failures impossible to catch however, and should
 
# only be disabled if your sftp version has problems with batch mode
 
#sftp_batch_mode = False
 
 
# The -tt argument is passed to ssh when pipelining is not enabled because sudo
 
# requires a tty by default.
 
#usetty = True
 
 
# Number of times to retry an SSH connection to a host, in case of UNREACHABLE.
 
# For each retry attempt, there is an [[exponential backoff]],
 
# so after the first attempt there is 1s wait, then 2s, 4s etc. up to 30s (max).
 
#retries = 3
 
 
[persistent_connection]
 
  
<pre>
 
 
# Configures the persistent connection timeout value in seconds.  This value is
 
# Configures the persistent connection timeout value in seconds.  This value is
 
# how long the persistent connection will remain idle before it is destroyed.
 
# how long the persistent connection will remain idle before it is destroyed.
Line 533: Line 519:
 
== Related terms ==
 
== Related terms ==
 
* <code>[[/etc/ansible/hosts]]</code>
 
* <code>[[/etc/ansible/hosts]]</code>
* [[Configure OpenSSH to reuse ssh connections]]
 
* [[ANSIBLE_DEBUG]]
 
* [[Is using the discovered Python interpreter at]]
 
* [[~/.ansible.cfg]]
 
* [[ANSIBLE_SSH_ARGS]]
 
  
 
== See also ==
 
== See also ==
* {{ansible.cfg}}
 
 
* {{Ansible}}
 
* {{Ansible}}
  
  
 
[[Category:Ansible]]
 
[[Category:Ansible]]

Please note that all contributions to wikieduonline may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Wikieduonline:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

Templates used on this page:

Advertising: