2014-01-04 13:31:44 -05:00
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
2012-02-28 19:08:09 -05:00
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
2015-05-03 21:47:26 -05:00
# Make coding more python3-ish
2015-10-19 18:36:19 -07:00
from __future__ import ( absolute_import , division , print_function )
2015-05-03 21:47:26 -05:00
__metaclass__ = type
2012-03-05 16:06:02 -05:00
import os
2015-07-06 14:12:10 -07:00
from string import ascii_letters , digits
2015-05-03 21:47:26 -05:00
2015-10-15 17:55:23 -07:00
from ansible . compat . six import string_types
from ansible . compat . six . moves import configparser
2012-03-05 16:06:02 -05:00
2015-10-26 14:23:09 -07:00
from ansible . parsing . quoting import unquote
2015-07-04 10:23:30 -04:00
from ansible . errors import AnsibleOptionsError
2013-07-03 16:47:20 -04:00
# copied from utils, avoid circular reference fun :)
def mk_boolean ( value ) :
2013-08-10 18:16:01 -04:00
if value is None :
return False
2013-07-03 16:47:20 -04:00
val = str ( value )
if val . lower ( ) in [ " true " , " t " , " y " , " 1 " , " yes " ] :
return True
else :
return False
2015-09-01 14:47:07 -04:00
def shell_expand ( path ) :
'''
shell_expand is needed as os . path . expanduser does not work
when path is None , which is the default for ANSIBLE_PRIVATE_KEY_FILE
'''
if path :
path = os . path . expanduser ( os . path . expandvars ( path ) )
return path
def get_config ( p , section , key , env_var , default , boolean = False , integer = False , floating = False , islist = False , isnone = False , ispath = False ) :
2013-07-03 16:47:20 -04:00
''' return a configuration variable with casting '''
value = _get_config ( p , section , key , env_var , default )
if boolean :
2015-05-03 21:47:26 -05:00
value = mk_boolean ( value )
if value :
if integer :
value = int ( value )
elif floating :
value = float ( value )
elif islist :
2015-07-06 14:12:10 -07:00
if isinstance ( value , string_types ) :
2015-05-03 21:47:26 -05:00
value = [ x . strip ( ) for x in value . split ( ' , ' ) ]
2015-05-08 10:12:36 -04:00
elif isnone :
if value == " None " :
value = None
2015-09-01 14:47:07 -04:00
elif ispath :
value = shell_expand ( value )
2015-09-01 14:48:59 -04:00
elif isinstance ( value , string_types ) :
value = unquote ( value )
2013-07-03 16:47:20 -04:00
return value
2013-12-12 18:48:02 +02:00
def _get_config ( p , section , key , env_var , default ) :
2013-07-03 16:47:20 -04:00
''' helper function for get_config '''
2012-10-16 18:40:01 -04:00
if env_var is not None :
2012-10-17 22:34:59 -04:00
value = os . environ . get ( env_var , None )
if value is not None :
return value
2012-08-13 19:17:14 -04:00
if p is not None :
try :
2013-09-18 15:03:40 -04:00
return p . get ( section , key , raw = True )
2012-08-13 19:17:14 -04:00
except :
return default
2012-10-18 20:27:39 -04:00
return default
2012-04-13 19:06:11 -04:00
2012-08-13 19:17:14 -04:00
def load_config_file ( ) :
2014-02-14 14:34:58 -06:00
''' Load Config File order(first found is used): ENV, CWD, HOME, /etc/ansible '''
2015-05-03 21:47:26 -05:00
p = configparser . ConfigParser ( )
2014-02-14 14:34:58 -06:00
path0 = os . getenv ( " ANSIBLE_CONFIG " , None )
if path0 is not None :
path0 = os . path . expanduser ( path0 )
2015-07-30 07:58:30 +05:30
if os . path . isdir ( path0 ) :
path0 + = " /ansible.cfg "
2013-10-11 08:25:57 -05:00
path1 = os . getcwd ( ) + " /ansible.cfg "
2014-02-14 14:34:58 -06:00
path2 = os . path . expanduser ( " ~/.ansible.cfg " )
2012-09-10 17:57:32 +03:00
path3 = " /etc/ansible/ansible.cfg "
2014-02-14 14:34:58 -06:00
for path in [ path0 , path1 , path2 , path3 ] :
if path is not None and os . path . exists ( path ) :
2014-08-29 17:43:30 +03:00
try :
p . read ( path )
2015-05-03 21:47:26 -05:00
except configparser . Error as e :
2015-07-04 10:23:30 -04:00
raise AnsibleOptionsError ( " Error reading config file: \n {0} " . format ( e ) )
return p , path
2015-07-05 12:50:36 -04:00
return None , ' '
2012-08-13 19:17:14 -04:00
2015-07-04 10:23:30 -04:00
p , CONFIG_FILE = load_config_file ( )
2012-08-13 19:17:14 -04:00
2013-10-31 12:05:52 -05:00
# check all of these extensions when looking for yaml files for things like
2014-03-06 21:47:49 -05:00
# group variables -- really anything we can load
YAML_FILENAME_EXTENSIONS = [ " " , " .yml " , " .yaml " , " .json " ]
2013-10-31 12:05:52 -05:00
2015-10-15 10:32:55 -04:00
# the default whitelist for cow stencils
DEFAULT_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 ' , ]
2012-08-13 19:17:14 -04:00
# sections in config file
DEFAULTS = ' defaults '
2015-12-09 08:28:54 -08:00
# FIXME: add deprecation warning when these get set
#### DEPRECATED VARS ####
# use more sanely named 'inventory'
2015-09-01 14:47:07 -04:00
DEPRECATED_HOST_LIST = get_config ( p , DEFAULTS , ' hostfile ' , ' ANSIBLE_HOSTS ' , ' /etc/ansible/hosts ' , ispath = True )
2015-12-09 08:28:54 -08:00
# this is not used since 0.5 but people might still have in config
DEFAULT_PATTERN = get_config ( p , DEFAULTS , ' pattern ' , None , None )
2015-08-18 03:27:39 -04:00
2015-12-09 08:28:54 -08:00
#### GENERALLY CONFIGURABLE THINGS ####
2015-05-03 21:47:26 -05:00
DEFAULT_DEBUG = get_config ( p , DEFAULTS , ' debug ' , ' ANSIBLE_DEBUG ' , False , boolean = True )
2015-09-01 14:47:07 -04:00
DEFAULT_HOST_LIST = get_config ( p , DEFAULTS , ' inventory ' , ' ANSIBLE_INVENTORY ' , DEPRECATED_HOST_LIST , ispath = True )
DEFAULT_MODULE_PATH = get_config ( p , DEFAULTS , ' library ' , ' ANSIBLE_LIBRARY ' , None , ispath = True )
DEFAULT_ROLES_PATH = get_config ( p , DEFAULTS , ' roles_path ' , ' ANSIBLE_ROLES_PATH ' , ' /etc/ansible/roles ' , ispath = True )
2014-07-29 15:13:50 +03:00
DEFAULT_REMOTE_TMP = get_config ( p , DEFAULTS , ' remote_tmp ' , ' ANSIBLE_REMOTE_TEMP ' , ' $HOME/.ansible/tmp ' )
2012-08-13 19:17:14 -04:00
DEFAULT_MODULE_NAME = get_config ( p , DEFAULTS , ' module_name ' , None , ' command ' )
2013-08-22 19:04:11 -04:00
DEFAULT_FORKS = get_config ( p , DEFAULTS , ' forks ' , ' ANSIBLE_FORKS ' , 5 , integer = True )
2012-08-13 19:17:14 -04:00
DEFAULT_MODULE_ARGS = get_config ( p , DEFAULTS , ' module_args ' , ' ANSIBLE_MODULE_ARGS ' , ' ' )
2015-12-02 22:25:10 +05:30
DEFAULT_MODULE_LANG = get_config ( p , DEFAULTS , ' module_lang ' , ' ANSIBLE_MODULE_LANG ' , os . getenv ( ' LANG ' , ' en_US.UTF-8 ' ) )
2013-08-22 19:04:11 -04:00
DEFAULT_TIMEOUT = get_config ( p , DEFAULTS , ' timeout ' , ' ANSIBLE_TIMEOUT ' , 10 , integer = True )
DEFAULT_POLL_INTERVAL = get_config ( p , DEFAULTS , ' poll_interval ' , ' ANSIBLE_POLL_INTERVAL ' , 15 , integer = True )
2015-10-23 23:15:45 -04:00
DEFAULT_REMOTE_USER = get_config ( p , DEFAULTS , ' remote_user ' , ' ANSIBLE_REMOTE_USER ' , None )
2013-07-03 16:47:20 -04:00
DEFAULT_ASK_PASS = get_config ( p , DEFAULTS , ' ask_pass ' , ' ANSIBLE_ASK_PASS ' , False , boolean = True )
2015-09-01 14:47:07 -04:00
DEFAULT_PRIVATE_KEY_FILE = get_config ( p , DEFAULTS , ' private_key_file ' , ' ANSIBLE_PRIVATE_KEY_FILE ' , None , ispath = True )
2014-01-23 12:49:07 -05:00
DEFAULT_REMOTE_PORT = get_config ( p , DEFAULTS , ' remote_port ' , ' ANSIBLE_REMOTE_PORT ' , None , integer = True )
2014-02-11 12:03:11 -05:00
DEFAULT_ASK_VAULT_PASS = get_config ( p , DEFAULTS , ' ask_vault_pass ' , ' ANSIBLE_ASK_VAULT_PASS ' , False , boolean = True )
2015-09-01 14:47:07 -04:00
DEFAULT_VAULT_PASSWORD_FILE = get_config ( p , DEFAULTS , ' vault_password_file ' , ' ANSIBLE_VAULT_PASSWORD_FILE ' , None , ispath = True )
2013-07-04 16:47:17 -04:00
DEFAULT_TRANSPORT = get_config ( p , DEFAULTS , ' transport ' , ' ANSIBLE_TRANSPORT ' , ' smart ' )
2013-07-03 16:47:20 -04:00
DEFAULT_SCP_IF_SSH = get_config ( p , ' ssh_connection ' , ' scp_if_ssh ' , ' ANSIBLE_SCP_IF_SSH ' , False , boolean = True )
2015-07-22 14:25:47 -04:00
DEFAULT_SFTP_BATCH_MODE = get_config ( p , ' ssh_connection ' , ' sftp_batch_mode ' , ' ANSIBLE_SFTP_BATCH_MODE ' , True , boolean = True )
2012-10-03 15:59:38 +02:00
DEFAULT_MANAGED_STR = get_config ( p , DEFAULTS , ' ansible_managed ' , None , ' Ansible managed: {file} modified on % Y- % m- %d % H: % M: % S by {uid} on {host} ' )
2012-11-09 22:13:00 -08:00
DEFAULT_SYSLOG_FACILITY = get_config ( p , DEFAULTS , ' syslog_facility ' , ' ANSIBLE_SYSLOG_FACILITY ' , ' LOG_USER ' )
2013-07-14 22:08:36 -04:00
DEFAULT_KEEP_REMOTE_FILES = get_config ( p , DEFAULTS , ' keep_remote_files ' , ' ANSIBLE_KEEP_REMOTE_FILES ' , False , boolean = True )
2013-01-23 21:39:34 +01:00
DEFAULT_HASH_BEHAVIOUR = get_config ( p , DEFAULTS , ' hash_behaviour ' , ' ANSIBLE_HASH_BEHAVIOUR ' , ' replace ' )
2015-07-01 11:32:44 -04:00
DEFAULT_PRIVATE_ROLE_VARS = get_config ( p , DEFAULTS , ' private_role_vars ' , ' ANSIBLE_PRIVATE_ROLE_VARS ' , False , boolean = True )
2013-02-13 17:33:43 +01:00
DEFAULT_JINJA2_EXTENSIONS = get_config ( p , DEFAULTS , ' jinja2_extensions ' , ' ANSIBLE_JINJA2_EXTENSIONS ' , None )
2013-04-04 13:10:30 +10:00
DEFAULT_EXECUTABLE = get_config ( p , DEFAULTS , ' executable ' , ' ANSIBLE_EXECUTABLE ' , ' /bin/sh ' )
2014-06-24 09:56:33 -05:00
DEFAULT_GATHERING = get_config ( p , DEFAULTS , ' gathering ' , ' ANSIBLE_GATHERING ' , ' implicit ' ) . lower ( )
2015-09-01 14:47:07 -04:00
DEFAULT_LOG_PATH = get_config ( p , DEFAULTS , ' log_path ' , ' ANSIBLE_LOG_PATH ' , ' ' , ispath = True )
2015-07-10 01:53:59 -04:00
DEFAULT_FORCE_HANDLERS = get_config ( p , DEFAULTS , ' force_handlers ' , ' ANSIBLE_FORCE_HANDLERS ' , False , boolean = True )
2015-07-18 15:24:44 -04:00
DEFAULT_INVENTORY_IGNORE = get_config ( p , DEFAULTS , ' inventory_ignore_extensions ' , ' ANSIBLE_INVENTORY_IGNORE ' , [ " ~ " , " .orig " , " .bak " , " .ini " , " .cfg " , " .retry " , " .pyc " , " .pyo " ] , islist = True )
2015-11-05 16:21:34 -05:00
DEFAULT_VAR_COMPRESSION_LEVEL = get_config ( p , DEFAULTS , ' var_compression_level ' , ' ANSIBLE_VAR_COMPRESSION_LEVEL ' , 0 , integer = True )
2015-05-14 10:50:22 -04:00
2015-09-25 23:57:03 -04:00
# disclosure
DEFAULT_NO_LOG = get_config ( p , DEFAULTS , ' no_log ' , ' ANSIBLE_NO_LOG ' , False , boolean = True )
2015-12-05 19:43:02 +01:00
DEFAULT_NO_TARGET_SYSLOG = get_config ( p , DEFAULTS , ' no_target_syslog ' , ' ANSIBLE_NO_TARGET_SYSLOG ' , False , boolean = True )
2015-09-25 23:57:03 -04:00
2015-05-14 10:50:22 -04:00
# selinux
2015-07-02 17:24:13 -04:00
DEFAULT_SELINUX_SPECIAL_FS = get_config ( p , ' selinux ' , ' special_context_filesystems ' , None , ' fuse, nfs, vboxsf, ramfs ' , islist = True )
2013-04-27 10:24:26 -04:00
2015-06-14 20:50:38 -04:00
### PRIVILEGE ESCALATION ###
# Backwards Compat
DEFAULT_SU = get_config ( p , DEFAULTS , ' su ' , ' ANSIBLE_SU ' , False , boolean = True )
DEFAULT_SU_USER = get_config ( p , DEFAULTS , ' su_user ' , ' ANSIBLE_SU_USER ' , ' root ' )
2015-09-02 09:29:34 -04:00
DEFAULT_SU_EXE = get_config ( p , DEFAULTS , ' su_exe ' , ' ANSIBLE_SU_EXE ' , None )
2015-09-02 11:31:39 -04:00
DEFAULT_SU_FLAGS = get_config ( p , DEFAULTS , ' su_flags ' , ' ANSIBLE_SU_FLAGS ' , None )
2015-06-14 20:50:38 -04:00
DEFAULT_ASK_SU_PASS = get_config ( p , DEFAULTS , ' ask_su_pass ' , ' ANSIBLE_ASK_SU_PASS ' , False , boolean = True )
DEFAULT_SUDO = get_config ( p , DEFAULTS , ' sudo ' , ' ANSIBLE_SUDO ' , False , boolean = True )
DEFAULT_SUDO_USER = get_config ( p , DEFAULTS , ' sudo_user ' , ' ANSIBLE_SUDO_USER ' , ' root ' )
2015-09-02 09:29:34 -04:00
DEFAULT_SUDO_EXE = get_config ( p , DEFAULTS , ' sudo_exe ' , ' ANSIBLE_SUDO_EXE ' , None )
2015-10-28 02:02:43 -04:00
DEFAULT_SUDO_FLAGS = get_config ( p , DEFAULTS , ' sudo_flags ' , ' ANSIBLE_SUDO_FLAGS ' , ' -H -S -n ' )
2015-06-14 20:50:38 -04:00
DEFAULT_ASK_SUDO_PASS = get_config ( p , DEFAULTS , ' ask_sudo_pass ' , ' ANSIBLE_ASK_SUDO_PASS ' , False , boolean = True )
# Become
2015-08-17 21:31:18 -04:00
BECOME_ERROR_STRINGS = { ' sudo ' : ' Sorry, try again. ' , ' su ' : ' Authentication failure ' , ' pbrun ' : ' ' , ' pfexec ' : ' ' , ' runas ' : ' ' , ' doas ' : ' Permission denied ' } #FIXME: deal with i18n
2015-09-06 18:30:39 +05:30
BECOME_MISSING_STRINGS = { ' sudo ' : ' sorry, a password is required to run sudo ' , ' su ' : ' ' , ' pbrun ' : ' ' , ' pfexec ' : ' ' , ' runas ' : ' ' , ' doas ' : ' Authorization required ' } #FIXME: deal with i18n
2015-08-17 21:31:18 -04:00
BECOME_METHODS = [ ' sudo ' , ' su ' , ' pbrun ' , ' pfexec ' , ' runas ' , ' doas ' ]
2015-09-17 14:59:22 +02:00
BECOME_ALLOW_SAME_USER = get_config ( p , ' privilege_escalation ' , ' become_allow_same_user ' , ' ANSIBLE_BECOME_ALLOW_SAME_USER ' , False , boolean = True )
2014-11-24 16:36:31 -05:00
DEFAULT_BECOME_METHOD = get_config ( p , ' privilege_escalation ' , ' become_method ' , ' ANSIBLE_BECOME_METHOD ' , ' sudo ' if DEFAULT_SUDO else ' su ' if DEFAULT_SU else ' sudo ' ) . lower ( )
2015-06-14 20:50:38 -04:00
DEFAULT_BECOME = get_config ( p , ' privilege_escalation ' , ' become ' , ' ANSIBLE_BECOME ' , False , boolean = True )
2015-05-03 21:47:26 -05:00
DEFAULT_BECOME_USER = get_config ( p , ' privilege_escalation ' , ' become_user ' , ' ANSIBLE_BECOME_USER ' , ' root ' )
2015-06-14 20:50:38 -04:00
DEFAULT_BECOME_EXE = get_config ( p , ' privilege_escalation ' , ' become_exe ' , ' ANSIBLE_BECOME_EXE ' , None )
DEFAULT_BECOME_FLAGS = get_config ( p , ' privilege_escalation ' , ' become_flags ' , ' ANSIBLE_BECOME_FLAGS ' , None )
2015-03-27 08:45:04 -04:00
DEFAULT_BECOME_ASK_PASS = get_config ( p , ' privilege_escalation ' , ' become_ask_pass ' , ' ANSIBLE_BECOME_ASK_PASS ' , False , boolean = True )
2014-11-24 16:36:31 -05:00
2015-07-07 11:59:20 -04:00
# PLUGINS
2015-11-04 18:46:47 -08:00
# Modules that can optimize with_items loops into a single call. Currently
# these modules must (1) take a "name" or "pkg" parameter that is a list. If
# the module takes both, bad things could happen.
# In the future we should probably generalize this even further
# (mapping of param: squash field)
2015-12-19 13:00:58 -08:00
DEFAULT_SQUASH_ACTIONS = get_config ( p , DEFAULTS , ' squash_actions ' , ' ANSIBLE_SQUASH_ACTIONS ' , " apt, dnf, package, pkgng, yum, zypper " , islist = True )
2015-07-07 11:59:20 -04:00
# paths
2015-09-15 11:38:42 -04:00
DEFAULT_ACTION_PLUGIN_PATH = get_config ( p , DEFAULTS , ' action_plugins ' , ' ANSIBLE_ACTION_PLUGINS ' , ' ~/.ansible/plugins/action:/usr/share/ansible/plugins/action ' , ispath = True )
DEFAULT_CACHE_PLUGIN_PATH = get_config ( p , DEFAULTS , ' cache_plugins ' , ' ANSIBLE_CACHE_PLUGINS ' , ' ~/.ansible/plugins/cache:/usr/share/ansible/plugins/cache ' , ispath = True )
DEFAULT_CALLBACK_PLUGIN_PATH = get_config ( p , DEFAULTS , ' callback_plugins ' , ' ANSIBLE_CALLBACK_PLUGINS ' , ' ~/.ansible/plugins/callback:/usr/share/ansible/plugins/callback ' , ispath = True )
DEFAULT_CONNECTION_PLUGIN_PATH = get_config ( p , DEFAULTS , ' connection_plugins ' , ' ANSIBLE_CONNECTION_PLUGINS ' , ' ~/.ansible/plugins/connection:/usr/share/ansible/plugins/connection ' , ispath = True )
DEFAULT_LOOKUP_PLUGIN_PATH = get_config ( p , DEFAULTS , ' lookup_plugins ' , ' ANSIBLE_LOOKUP_PLUGINS ' , ' ~/.ansible/plugins/lookup:/usr/share/ansible/plugins/lookup ' , ispath = True )
2015-09-21 10:10:21 -04:00
DEFAULT_INVENTORY_PLUGIN_PATH = get_config ( p , DEFAULTS , ' inventory_plugins ' , ' ANSIBLE_INVENTORY_PLUGINS ' , ' ~/.ansible/plugins/inventory:/usr/share/ansible/plugins/inventory ' , ispath = True )
2015-09-15 11:38:42 -04:00
DEFAULT_VARS_PLUGIN_PATH = get_config ( p , DEFAULTS , ' vars_plugins ' , ' ANSIBLE_VARS_PLUGINS ' , ' ~/.ansible/plugins/vars:/usr/share/ansible/plugins/vars ' , ispath = True )
DEFAULT_FILTER_PLUGIN_PATH = get_config ( p , DEFAULTS , ' filter_plugins ' , ' ANSIBLE_FILTER_PLUGINS ' , ' ~/.ansible/plugins/filter:/usr/share/ansible/plugins/filter ' , ispath = True )
DEFAULT_TEST_PLUGIN_PATH = get_config ( p , DEFAULTS , ' test_plugins ' , ' ANSIBLE_TEST_PLUGINS ' , ' ~/.ansible/plugins/test:/usr/share/ansible/plugins/test ' , ispath = True )
2015-05-03 21:47:26 -05:00
DEFAULT_STDOUT_CALLBACK = get_config ( p , DEFAULTS , ' stdout_callback ' , ' ANSIBLE_STDOUT_CALLBACK ' , ' default ' )
2015-07-07 11:59:20 -04:00
# cache
2014-08-11 11:37:30 -04:00
CACHE_PLUGIN = get_config ( p , DEFAULTS , ' fact_caching ' , ' ANSIBLE_CACHE_PLUGIN ' , ' memory ' )
2014-08-11 15:16:51 -04:00
CACHE_PLUGIN_CONNECTION = get_config ( p , DEFAULTS , ' fact_caching_connection ' , ' ANSIBLE_CACHE_PLUGIN_CONNECTION ' , None )
CACHE_PLUGIN_PREFIX = get_config ( p , DEFAULTS , ' fact_caching_prefix ' , ' ANSIBLE_CACHE_PLUGIN_PREFIX ' , ' ansible_facts ' )
CACHE_PLUGIN_TIMEOUT = get_config ( p , DEFAULTS , ' fact_caching_timeout ' , ' ANSIBLE_CACHE_PLUGIN_TIMEOUT ' , 24 * 60 * 60 , integer = True )
2014-07-02 20:02:28 -05:00
2015-06-14 20:50:38 -04:00
# Display
2014-03-16 17:08:26 -04:00
ANSIBLE_FORCE_COLOR = get_config ( p , DEFAULTS , ' force_color ' , ' ANSIBLE_FORCE_COLOR ' , None , boolean = True )
2013-08-10 18:16:01 -04:00
ANSIBLE_NOCOLOR = get_config ( p , DEFAULTS , ' nocolor ' , ' ANSIBLE_NOCOLOR ' , None , boolean = True )
ANSIBLE_NOCOWS = get_config ( p , DEFAULTS , ' nocows ' , ' ANSIBLE_NOCOWS ' , None , boolean = True )
2015-10-15 10:32:55 -04:00
ANSIBLE_COW_SELECTION = get_config ( p , DEFAULTS , ' cow_selection ' , ' ANSIBLE_COW_SELECTION ' , ' default ' )
ANSIBLE_COW_WHITELIST = get_config ( p , DEFAULTS , ' cow_whitelist ' , ' ANSIBLE_COW_WHITELIST ' , DEFAULT_COW_WHITELIST , islist = True )
2013-09-26 10:03:23 -04:00
DISPLAY_SKIPPED_HOSTS = get_config ( p , DEFAULTS , ' display_skipped_hosts ' , ' DISPLAY_SKIPPED_HOSTS ' , True , boolean = True )
2013-10-11 18:37:39 -04:00
DEFAULT_UNDEFINED_VAR_BEHAVIOR = get_config ( p , DEFAULTS , ' error_on_undefined_vars ' , ' ANSIBLE_ERROR_ON_UNDEFINED_VARS ' , True , boolean = True )
HOST_KEY_CHECKING = get_config ( p , DEFAULTS , ' host_key_checking ' , ' ANSIBLE_HOST_KEY_CHECKING ' , True , boolean = True )
2014-04-30 14:44:10 -05:00
SYSTEM_WARNINGS = get_config ( p , DEFAULTS , ' system_warnings ' , ' ANSIBLE_SYSTEM_WARNINGS ' , True , boolean = True )
2013-10-11 18:37:39 -04:00
DEPRECATION_WARNINGS = get_config ( p , DEFAULTS , ' deprecation_warnings ' , ' ANSIBLE_DEPRECATION_WARNINGS ' , True , boolean = True )
2014-06-24 09:56:33 -05:00
DEFAULT_CALLABLE_WHITELIST = get_config ( p , DEFAULTS , ' callable_whitelist ' , ' ANSIBLE_CALLABLE_WHITELIST ' , [ ] , islist = True )
2015-07-18 15:24:44 -04:00
COMMAND_WARNINGS = get_config ( p , DEFAULTS , ' command_warnings ' , ' ANSIBLE_COMMAND_WARNINGS ' , True , boolean = True )
2014-09-10 09:38:24 -04:00
DEFAULT_LOAD_CALLBACK_PLUGINS = get_config ( p , DEFAULTS , ' bin_ansible_callbacks ' , ' ANSIBLE_LOAD_CALLBACK_PLUGINS ' , False , boolean = True )
2015-07-08 16:33:00 -04:00
DEFAULT_CALLBACK_WHITELIST = get_config ( p , DEFAULTS , ' callback_whitelist ' , ' ANSIBLE_CALLBACK_WHITELIST ' , [ ] , islist = True )
2015-05-03 21:47:26 -05:00
RETRY_FILES_ENABLED = get_config ( p , DEFAULTS , ' retry_files_enabled ' , ' ANSIBLE_RETRY_FILES_ENABLED ' , True , boolean = True )
2016-01-26 14:11:28 -05:00
RETRY_FILES_SAVE_PATH = get_config ( p , DEFAULTS , ' retry_files_save_path ' , ' ANSIBLE_RETRY_FILES_SAVE_PATH ' , None , ispath = True )
2015-05-08 10:12:36 -04:00
DEFAULT_NULL_REPRESENTATION = get_config ( p , DEFAULTS , ' null_representation ' , ' ANSIBLE_NULL_REPRESENTATION ' , None , isnone = True )
2013-10-11 18:37:39 -04:00
# CONNECTION RELATED
2015-10-02 13:13:49 +05:30
ANSIBLE_SSH_ARGS = get_config ( p , ' ssh_connection ' , ' ssh_args ' , ' ANSIBLE_SSH_ARGS ' , ' -o ControlMaster=auto -o ControlPersist=60s ' )
2013-09-18 15:03:40 -04:00
ANSIBLE_SSH_CONTROL_PATH = get_config ( p , ' ssh_connection ' , ' control_path ' , ' ANSIBLE_SSH_CONTROL_PATH ' , " %(directory)s /ansible-ssh- %% h- %% p- %% r " )
2015-12-03 08:01:05 -08:00
ANSIBLE_SSH_PIPELINING = get_config ( p , ' ssh_connection ' , ' pipelining ' , ' ANSIBLE_SSH_PIPELINING ' , False , boolean = True )
2015-03-27 18:24:33 +00:00
ANSIBLE_SSH_RETRIES = get_config ( p , ' ssh_connection ' , ' retries ' , ' ANSIBLE_SSH_RETRIES ' , 0 , integer = True )
2013-07-05 21:42:41 -04:00
PARAMIKO_RECORD_HOST_KEYS = get_config ( p , ' paramiko_connection ' , ' record_host_keys ' , ' ANSIBLE_PARAMIKO_RECORD_HOST_KEYS ' , True , boolean = True )
2015-03-27 18:24:33 +00:00
2015-07-07 11:59:20 -04:00
2014-11-24 16:36:31 -05:00
# obsolete -- will be formally removed
2013-08-22 19:04:11 -04:00
ZEROMQ_PORT = get_config ( p , ' fireball_connection ' , ' zeromq_port ' , ' ANSIBLE_ZEROMQ_PORT ' , 5099 , integer = True )
ACCELERATE_PORT = get_config ( p , ' accelerate ' , ' accelerate_port ' , ' ACCELERATE_PORT ' , 5099 , integer = True )
2013-10-07 08:39:23 -04:00
ACCELERATE_TIMEOUT = get_config ( p , ' accelerate ' , ' accelerate_timeout ' , ' ACCELERATE_TIMEOUT ' , 30 , integer = True )
ACCELERATE_CONNECT_TIMEOUT = get_config ( p , ' accelerate ' , ' accelerate_connect_timeout ' , ' ACCELERATE_CONNECT_TIMEOUT ' , 1.0 , floating = True )
2014-03-23 14:45:05 -05:00
ACCELERATE_DAEMON_TIMEOUT = get_config ( p , ' accelerate ' , ' accelerate_daemon_timeout ' , ' ACCELERATE_DAEMON_TIMEOUT ' , 30 , integer = True )
2014-02-06 08:53:43 +00:00
ACCELERATE_KEYS_DIR = get_config ( p , ' accelerate ' , ' accelerate_keys_dir ' , ' ACCELERATE_KEYS_DIR ' , ' ~/.fireball.keys ' )
ACCELERATE_KEYS_DIR_PERMS = get_config ( p , ' accelerate ' , ' accelerate_keys_dir_perms ' , ' ACCELERATE_KEYS_DIR_PERMS ' , ' 700 ' )
ACCELERATE_KEYS_FILE_PERMS = get_config ( p , ' accelerate ' , ' accelerate_keys_file_perms ' , ' ACCELERATE_KEYS_FILE_PERMS ' , ' 600 ' )
2014-03-19 12:59:06 -05:00
ACCELERATE_MULTI_KEY = get_config ( p , ' accelerate ' , ' accelerate_multi_key ' , ' ACCELERATE_MULTI_KEY ' , False , boolean = True )
2013-09-25 16:15:49 +04:00
PARAMIKO_PTY = get_config ( p , ' paramiko_connection ' , ' pty ' , ' ANSIBLE_PARAMIKO_PTY ' , True , boolean = True )
2012-09-18 14:41:27 +02:00
2015-05-03 21:47:26 -05:00
# galaxy related
2015-12-09 10:51:12 -05:00
GALAXY_SERVER = get_config ( p , ' galaxy ' , ' server ' , ' ANSIBLE_GALAXY_SERVER ' , ' https://galaxy.ansible.com ' )
GALAXY_IGNORE_CERTS = get_config ( p , ' galaxy ' , ' ignore_certs ' , ' ANSIBLE_GALAXY_IGNORE ' , False , boolean = True )
2015-05-03 21:47:26 -05:00
# this can be configured to blacklist SCMS but cannot add new ones unless the code is also updated
2015-07-08 16:33:00 -04:00
GALAXY_SCMS = get_config ( p , ' galaxy ' , ' scms ' , ' ANSIBLE_GALAXY_SCMS ' , ' git, hg ' , islist = True )
2015-05-03 21:47:26 -05:00
2013-11-01 09:51:35 -05:00
# characters included in auto-generated passwords
DEFAULT_PASSWORD_CHARS = ascii_letters + digits + " .,:-_ "
2015-11-12 18:42:39 -08:00
STRING_TYPE_FILTERS = get_config ( p , ' jinja2 ' , ' dont_type_filters ' , ' ANSIBLE_STRING_TYPE_FILTERS ' , [ ' string ' , ' to_json ' , ' to_nice_json ' , ' to_yaml ' , ' ppretty ' , ' json ' ] , islist = True )
2013-06-18 13:24:30 -04:00
2015-12-29 15:41:00 -05:00
# colors
COLOR_VERBOSE = get_config ( p , ' colors ' , ' verbose ' , ' ANSIBLE_COLOR_VERBOSE ' , ' blue ' )
COLOR_WARN = get_config ( p , ' colors ' , ' warn ' , ' ANSIBLE_COLOR_WARN ' , ' bright purple ' )
COLOR_ERROR = get_config ( p , ' colors ' , ' error ' , ' ANSIBLE_COLOR_ERROR ' , ' red ' )
COLOR_DEBUG = get_config ( p , ' colors ' , ' debug ' , ' ANSIBLE_COLOR_DEBUG ' , ' dark gray ' )
COLOR_DEPRECATE = get_config ( p , ' colors ' , ' deprecate ' , ' ANSIBLE_COLOR_DEPRECATE ' , ' purple ' )
COLOR_SKIP = get_config ( p , ' colors ' , ' skip ' , ' ANSIBLE_COLOR_SKIP ' , ' cyan ' )
COLOR_UNREACHABLE = get_config ( p , ' colors ' , ' unreachable ' , ' ANSIBLE_COLOR_UNREACHABLE ' , ' bright red ' )
COLOR_OK = get_config ( p , ' colors ' , ' ok ' , ' ANSIBLE_COLOR_OK ' , ' green ' )
COLOR_CHANGED = get_config ( p , ' colors ' , ' ok ' , ' ANSIBLE_COLOR_CHANGED ' , ' yellow ' )
2016-02-17 10:10:07 +00:00
COLOR_DIFF_ADD = get_config ( p , ' colors ' , ' diff_add ' , ' ANSIBLE_COLOR_DIFF_ADD ' , ' green ' )
COLOR_DIFF_REMOVE = get_config ( p , ' colors ' , ' diff_remove ' , ' ANSIBLE_COLOR_DIFF_REMOVE ' , ' red ' )
COLOR_DIFF_LINES = get_config ( p , ' colors ' , ' diff_lines ' , ' ANSIBLE_COLOR_DIFF_LINES ' , ' cyan ' )
2015-12-29 15:41:00 -05:00
2012-08-13 19:17:14 -04:00
# non-configurable things
2015-05-03 21:47:26 -05:00
MODULE_REQUIRE_ARGS = [ ' command ' , ' shell ' , ' raw ' , ' script ' ]
2015-07-23 13:42:20 -04:00
MODULE_NO_JSON = [ ' command ' , ' shell ' , ' raw ' ]
2014-11-24 16:36:31 -05:00
DEFAULT_BECOME_PASS = None
2012-08-13 19:17:14 -04:00
DEFAULT_SUDO_PASS = None
2012-10-26 14:49:56 -04:00
DEFAULT_REMOTE_PASS = None
2012-08-13 19:17:14 -04:00
DEFAULT_SUBSET = None
2014-01-20 19:19:03 -06:00
DEFAULT_SU_PASS = None
2014-02-11 12:03:11 -05:00
VAULT_VERSION_MIN = 1.0
VAULT_VERSION_MAX = 1.0
2015-07-26 12:21:38 -04:00
MAX_FILE_SIZE_FOR_DIFF = 1 * 1024 * 1024
2015-08-11 19:18:10 -04:00
TREE_DIR = None
2015-08-18 20:02:03 -04:00
LOCALHOST = frozenset ( [ ' 127.0.0.1 ' , ' localhost ' , ' ::1 ' ] )