diff --git a/docsite/rst/intro_configuration.rst b/docsite/rst/intro_configuration.rst index a857ec90cdd..4cb1f359948 100644 --- a/docsite/rst/intro_configuration.rst +++ b/docsite/rst/intro_configuration.rst @@ -70,7 +70,7 @@ Actions are pieces of code in ansible that enable things like module execution, This is a developer-centric feature that allows low-level extensions around Ansible to be loaded from different locations:: - action_plugins = /usr/share/ansible_plugins/action_plugins + action_plugins = ~/.ansible/plugins/action_plugins/:/usr/share/ansible_plugins/action_plugins Most users will not need to use this feature. See :doc:`developing_plugins` for more details. @@ -135,10 +135,12 @@ Prior to 1.8, callbacks were never loaded for /usr/bin/ansible. callback_plugins ================ +Callbacks are pieces of code in ansible that get called on specific events, permitting to trigger notifications. + This is a developer-centric feature that allows low-level extensions around Ansible to be loaded from different locations:: - callback_plugins = /usr/share/ansible_plugins/callback_plugins + callback_plugins = ~/.ansible/plugins/callback_plugins/:/usr/share/ansible_plugins/callback_plugins Most users will not need to use this feature. See :doc:`developing_plugins` for more details @@ -171,10 +173,12 @@ parameter string, like so:: connection_plugins ================== +Connections plugin permit to extend the channel used by ansible to transport commands and files. + This is a developer-centric feature that allows low-level extensions around Ansible to be loaded from different locations:: - connection_plugins = /usr/share/ansible_plugins/connection_plugins + connection_plugins = ~/.ansible/plugins/connection_plugins/:/usr/share/ansible_plugins/connection_plugins Most users will not need to use this feature. See :doc:`developing_plugins` for more details @@ -230,10 +234,12 @@ rare instances to /bin/bash in rare instances when sudo is constrained, but in m filter_plugins ============== +Filters are specific functions that can be used to extend the template system. + This is a developer-centric feature that allows low-level extensions around Ansible to be loaded from different locations:: - filter_plugins = /usr/share/ansible_plugins/filter_plugins + filter_plugins = ~/.ansible/plugins/filter_plugins/:/usr/share/ansible_plugins/filter_plugins Most users will not need to use this feature. See :doc:`developing_plugins` for more details @@ -359,7 +365,7 @@ lookup_plugins This is a developer-centric feature that allows low-level extensions around Ansible to be loaded from different locations:: - lookup_plugins = /usr/share/ansible_plugins/lookup_plugins + lookup_plugins = ~/.ansible/plugins/lookup_plugins/:/usr/share/ansible_plugins/lookup_plugins Most users will not need to use this feature. See :doc:`developing_plugins` for more details @@ -562,7 +568,7 @@ vars_plugins This is a developer-centric feature that allows low-level extensions around Ansible to be loaded from different locations:: - vars_plugins = /usr/share/ansible_plugins/vars_plugins + vars_plugins = ~/.ansible/plugins/vars_plugins/:/usr/share/ansible_plugins/vars_plugins Most users will not need to use this feature. See :doc:`developing_plugins` for more details diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py index b7aca6f36f6..31dc91463e8 100644 --- a/lib/ansible/constants.py +++ b/lib/ansible/constants.py @@ -86,6 +86,9 @@ def shell_expand_path(path): path = os.path.expanduser(os.path.expandvars(path)) return path +def get_plugin_paths(path): + return ':'.join([os.path.join(x, path) for x in [os.path.expanduser('~/.ansible/plugins/'), '/usr/share/ansible_plugins/']]) + p = load_config_file() active_user = pwd.getpwuid(os.geteuid())[0] @@ -135,13 +138,13 @@ DEFAULT_SU_USER = get_config(p, DEFAULTS, 'su_user', 'ANSIBLE_SU_USER' DEFAULT_ASK_SU_PASS = get_config(p, DEFAULTS, 'ask_su_pass', 'ANSIBLE_ASK_SU_PASS', False, boolean=True) DEFAULT_GATHERING = get_config(p, DEFAULTS, 'gathering', 'ANSIBLE_GATHERING', 'implicit').lower() -DEFAULT_ACTION_PLUGIN_PATH = get_config(p, DEFAULTS, 'action_plugins', 'ANSIBLE_ACTION_PLUGINS', '/usr/share/ansible_plugins/action_plugins') -DEFAULT_CACHE_PLUGIN_PATH = get_config(p, DEFAULTS, 'cache_plugins', 'ANSIBLE_CACHE_PLUGINS', '/usr/share/ansible_plugins/cache_plugins') -DEFAULT_CALLBACK_PLUGIN_PATH = get_config(p, DEFAULTS, 'callback_plugins', 'ANSIBLE_CALLBACK_PLUGINS', '/usr/share/ansible_plugins/callback_plugins') -DEFAULT_CONNECTION_PLUGIN_PATH = get_config(p, DEFAULTS, 'connection_plugins', 'ANSIBLE_CONNECTION_PLUGINS', '/usr/share/ansible_plugins/connection_plugins') -DEFAULT_LOOKUP_PLUGIN_PATH = get_config(p, DEFAULTS, 'lookup_plugins', 'ANSIBLE_LOOKUP_PLUGINS', '/usr/share/ansible_plugins/lookup_plugins') -DEFAULT_VARS_PLUGIN_PATH = get_config(p, DEFAULTS, 'vars_plugins', 'ANSIBLE_VARS_PLUGINS', '/usr/share/ansible_plugins/vars_plugins') -DEFAULT_FILTER_PLUGIN_PATH = get_config(p, DEFAULTS, 'filter_plugins', 'ANSIBLE_FILTER_PLUGINS', '/usr/share/ansible_plugins/filter_plugins') +DEFAULT_ACTION_PLUGIN_PATH = get_config(p, DEFAULTS, 'action_plugins', 'ANSIBLE_ACTION_PLUGINS', get_plugin_paths('action_plugins')) +DEFAULT_CACHE_PLUGIN_PATH = get_config(p, DEFAULTS, 'cache_plugins', 'ANSIBLE_CACHE_PLUGINS', get_plugin_paths('cache_plugins')) +DEFAULT_CALLBACK_PLUGIN_PATH = get_config(p, DEFAULTS, 'callback_plugins', 'ANSIBLE_CALLBACK_PLUGINS', get_plugin_paths('callback_plugins')) +DEFAULT_CONNECTION_PLUGIN_PATH = get_config(p, DEFAULTS, 'connection_plugins', 'ANSIBLE_CONNECTION_PLUGINS', get_plugin_paths('connection_plugins')) +DEFAULT_LOOKUP_PLUGIN_PATH = get_config(p, DEFAULTS, 'lookup_plugins', 'ANSIBLE_LOOKUP_PLUGINS', get_plugin_paths('lookup_plugins')) +DEFAULT_VARS_PLUGIN_PATH = get_config(p, DEFAULTS, 'vars_plugins', 'ANSIBLE_VARS_PLUGINS', get_plugin_paths('vars_plugins')) +DEFAULT_FILTER_PLUGIN_PATH = get_config(p, DEFAULTS, 'filter_plugins', 'ANSIBLE_FILTER_PLUGINS', get_plugin_paths('filter_plugins')) DEFAULT_LOG_PATH = shell_expand_path(get_config(p, DEFAULTS, 'log_path', 'ANSIBLE_LOG_PATH', '')) CACHE_PLUGIN = get_config(p, DEFAULTS, 'fact_caching', 'ANSIBLE_CACHE_PLUGIN', 'memory')