2018-04-18 01:45:07 +00:00
.. _ansible_configuration_settings:
2018-02-13 15:23:55 +00:00
{% set name = 'Ansible Configuration Settings' -%}
2017-08-31 14:11:05 +00:00
{% set name_slug = 'config' -%}
{% set name_len = name|length + 0-%}
{{ '=' * name_len }}
{{name}}
{{ '=' * name_len }}
2018-02-13 15:23:55 +00:00
Ansible supports a few ways of providing configuration variables, mainly through environment variables, command line switches and an ini file named ``ansible.cfg``.
2017-09-23 03:19:50 +00:00
2017-12-20 15:20:05 +00:00
Starting at Ansible 2.4 the ``ansible-config`` utility allows users to see all the configuration settings available, their defaults, how to set them and
2017-09-23 03:19:50 +00:00
where their current value comes from. See :doc:ansible-config for more information.
The configuration file
======================
2017-10-11 04:15:25 +00:00
Changes can be made and used in a configuration file which will be searched for in the following order:
2017-09-23 03:19:50 +00:00
2017-12-20 15:20:05 +00:00
* ``ANSIBLE_CONFIG`` (environment variable if set)
* ``ansible.cfg`` (in the current directory)
* ``~/.ansible.cfg`` (in the home directory)
* ``/etc/ansible/ansible.cfg``
2017-09-23 03:19:50 +00:00
Ansible will process the above list and use the first file found, all others are ignored.
2017-12-20 15:20:05 +00:00
.. note::
The configuration file is one variant of an INI format.
Both the hash sign (``#``) and semicolon (``;``) are allowed as
comment markers when the comment starts the line.
However, if the comment is inline with regular values,
only the semicolon is allowed to introduce the comment.
For instance::
2017-09-23 03:19:50 +00:00
# some basic default values...
inventory = /etc/ansible/hosts ; This points to the file that lists your hosts
2017-08-31 14:11:05 +00:00
Common Options
==============
2017-09-23 03:19:50 +00:00
This is a copy of the options available from our release, your local install might have extra options due to additional plugins,
you can use the command line utility mentioned above (`ansible-config`) to browse through those.
2017-08-31 14:11:05 +00:00
{% if config_options %}
{% for config_option in config_options|sort %}
{% set config_len = config_option|length -%}
{% set config = config_options[config_option] %}
.. _{{config_option}}:
{{config_option}}
{{ '-' * config_len }}
{% if config['description'] and config['description'] != [''] %}
{% if config['description'] != ['TODO: write it'] %}
:Description: {{' '.join(config['description'])}}
{% endif %}
{% endif %}
{% if config['type'] %}
:Type: {{config['type']}}
{% endif %}
:Default: {{config['default']}}
{% if config['version_added'] %}
:Version Added: {{config['version_added']}}
{% endif %}
2017-11-28 18:05:19 +00:00
{% for ini_map in config['ini']|sort(attribute='section') %}
2017-08-31 14:11:05 +00:00
:Ini Section: {{ini_map['section']}}
:Ini Key: {{ini_map['key']}}
{% endfor %}
2017-11-28 18:05:19 +00:00
{% for env_var_map in config['env']|sort(attribute='name') %}
2017-08-31 14:11:05 +00:00
:Environment: :envvar:`{{env_var_map['name']}}`
{% endfor %}
{% if config['deprecated'] %}
:Deprecated in: {{config['deprecated']['version']}}
:Deprecated detail: {{config['deprecated']['why']}}
:Deprecated alternatives: {{config['deprecated']['alternatives']}}
{% endif %}
{% endfor %}
Environment Variables
=====================
2017-09-01 21:53:42 +00:00
.. envvar:: ANSIBLE_CONFIG
Override the default ansible config file
2017-08-31 14:11:05 +00:00
{% for config_option in config_options %}
{% for env_var_map in config_options[config_option]['env'] %}
.. envvar:: {{env_var_map['name']}}
{% if config_options[config_option]['description'] and config_options[config_option]['description'] != [''] %}
{% if config_options[config_option]['description'] != ['TODO: write it'] %}
{{ ''.join(config_options[config_option]['description']) }}
{% endif %}
{% endif %}
See also :ref:`{{config_option}} <{{config_option}}>`
{% endfor %}
{% endfor %}
{% endif %}