diff --git a/docsite/rst/developing_plugins.rst b/docsite/rst/developing_plugins.rst index 97be451b54..e1fda78cb0 100644 --- a/docsite/rst/developing_plugins.rst +++ b/docsite/rst/developing_plugins.rst @@ -21,7 +21,7 @@ Carrier Pigeon?) it's as simple as copying the format of one of the existing mod directory. The value of 'smart' for a connection allows selection of paramiko or openssh based on system capabilities, and chooses 'ssh' if OpenSSH supports ControlPersist, in Ansible 1.2.1 an later. Previous versions did not support 'smart'. -More documentation on writing connection plugins is pending, though you can jump into `lib/ansible/plugins/connections `_ and figure things out pretty easily. +More documentation on writing connection plugins is pending, though you can jump into `lib/ansible/plugins/connection `_ and figure things out pretty easily. .. _developing_lookup_plugins: diff --git a/examples/ansible.cfg b/examples/ansible.cfg index 4ab8cca172..a1faa6fa66 100644 --- a/examples/ansible.cfg +++ b/examples/ansible.cfg @@ -125,12 +125,13 @@ ansible_managed = Ansible managed: {file} on {host} # set plugin path directories here, separate with colons -action_plugins = /usr/share/ansible_plugins/action_plugins -callback_plugins = /usr/share/ansible_plugins/callback_plugins -connection_plugins = /usr/share/ansible_plugins/connection_plugins -lookup_plugins = /usr/share/ansible_plugins/lookup_plugins -vars_plugins = /usr/share/ansible_plugins/vars_plugins -filter_plugins = /usr/share/ansible_plugins/filter_plugins +#action_plugins = /usr/share/ansible/plugins/action +#callback_plugins = /usr/share/ansible/plugins/callback +#connection_plugins = /usr/share/ansible/plugins/connection +#lookup_plugins = /usr/share/ansible/plugins/lookup +#vars_plugins = /usr/share/ansible/plugins/vars +#filter_plugins = /usr/share/ansible/plugins/filter +#test_plugins = /usr/share/ansible/plugins/test # 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 diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py index e23e99f551..e7fec130e2 100644 --- a/lib/ansible/constants.py +++ b/lib/ansible/constants.py @@ -184,14 +184,15 @@ DEFAULT_BECOME_ASK_PASS = get_config(p, 'privilege_escalation', 'become_ask_pa # PLUGINS DEFAULT_SQUASH_ACTIONS = get_config(p, DEFAULTS, 'squash_actions', 'ANSIBLE_SQUASH_ACTIONS', "apt, yum, pkgng, zypper, dnf", islist=True) # paths -DEFAULT_ACTION_PLUGIN_PATH = get_config(p, DEFAULTS, 'action_plugins', 'ANSIBLE_ACTION_PLUGINS', '~/.ansible/plugins/action_plugins:/usr/share/ansible_plugins/action_plugins', ispath=True) -DEFAULT_CACHE_PLUGIN_PATH = get_config(p, DEFAULTS, 'cache_plugins', 'ANSIBLE_CACHE_PLUGINS', '~/.ansible/plugins/cache_plugins:/usr/share/ansible_plugins/cache_plugins', ispath=True) -DEFAULT_CALLBACK_PLUGIN_PATH = get_config(p, DEFAULTS, 'callback_plugins', 'ANSIBLE_CALLBACK_PLUGINS', '~/.ansible/plugins/callback_plugins:/usr/share/ansible_plugins/callback_plugins', ispath=True) -DEFAULT_CONNECTION_PLUGIN_PATH = get_config(p, DEFAULTS, 'connection_plugins', 'ANSIBLE_CONNECTION_PLUGINS', '~/.ansible/plugins/connection_plugins:/usr/share/ansible_plugins/connection_plugins', ispath=True) -DEFAULT_LOOKUP_PLUGIN_PATH = get_config(p, DEFAULTS, 'lookup_plugins', 'ANSIBLE_LOOKUP_PLUGINS', '~/.ansible/plugins/lookup_plugins:/usr/share/ansible_plugins/lookup_plugins', ispath=True) -DEFAULT_VARS_PLUGIN_PATH = get_config(p, DEFAULTS, 'vars_plugins', 'ANSIBLE_VARS_PLUGINS', '~/.ansible/plugins/vars_plugins:/usr/share/ansible_plugins/vars_plugins', ispath=True) -DEFAULT_FILTER_PLUGIN_PATH = get_config(p, DEFAULTS, 'filter_plugins', 'ANSIBLE_FILTER_PLUGINS', '~/.ansible/plugins/filter_plugins:/usr/share/ansible_plugins/filter_plugins', ispath=True) -DEFAULT_TEST_PLUGIN_PATH = get_config(p, DEFAULTS, 'test_plugins', 'ANSIBLE_TEST_PLUGINS', '~/.ansible/plugins/test_plugins:/usr/share/ansible_plugins/test_plugins', ispath=True) +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) +DEFAULT_INVENTORy_PLUGIN_PATH = get_config(p, DEFAULTS, 'inventory_plugins', 'ANSIBLE_INVENTORY_PLUGINS', '~/.ansible/plugins/inventory:/usr/share/ansible/plugins/inventory', ispath=True) +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) DEFAULT_STDOUT_CALLBACK = get_config(p, DEFAULTS, 'stdout_callback', 'ANSIBLE_STDOUT_CALLBACK', 'default') # cache CACHE_PLUGIN = get_config(p, DEFAULTS, 'fact_caching', 'ANSIBLE_CACHE_PLUGIN', 'memory') diff --git a/lib/ansible/playbook/role/__init__.py b/lib/ansible/playbook/role/__init__.py index 96a3f735c7..5e529ca190 100644 --- a/lib/ansible/playbook/role/__init__.py +++ b/lib/ansible/playbook/role/__init__.py @@ -45,7 +45,7 @@ __all__ = ['Role', 'hash_params'] # FIXME: this should be a utility function, but can't be a member of # the role due to the fact that it would require the use of self # in a static method. This is also used in the base class for -# strategies (ansible/plugins/strategies/__init__.py) +# strategies (ansible/plugins/strategy/__init__.py) def hash_params(params): if not isinstance(params, dict): return params diff --git a/lib/ansible/plugins/__init__.py b/lib/ansible/plugins/__init__.py index cdf1d97530..06f2261138 100644 --- a/lib/ansible/plugins/__init__.py +++ b/lib/ansible/plugins/__init__.py @@ -317,7 +317,7 @@ callback_loader = PluginLoader( connection_loader = PluginLoader( 'Connection', - 'ansible.plugins.connections', + 'ansible.plugins.connection', C.DEFAULT_CONNECTION_PLUGIN_PATH, 'connection_plugins', aliases={'paramiko': 'paramiko_ssh'}, @@ -376,7 +376,7 @@ fragment_loader = PluginLoader( strategy_loader = PluginLoader( 'StrategyModule', - 'ansible.plugins.strategies', + 'ansible.plugins.strategy', None, 'strategy_plugins', required_base_class='StrategyBase', diff --git a/lib/ansible/plugins/connections/__init__.py b/lib/ansible/plugins/connection/__init__.py similarity index 100% rename from lib/ansible/plugins/connections/__init__.py rename to lib/ansible/plugins/connection/__init__.py diff --git a/lib/ansible/plugins/connections/accelerate.py b/lib/ansible/plugins/connection/accelerate.py similarity index 100% rename from lib/ansible/plugins/connections/accelerate.py rename to lib/ansible/plugins/connection/accelerate.py diff --git a/lib/ansible/plugins/connections/chroot.py b/lib/ansible/plugins/connection/chroot.py similarity index 99% rename from lib/ansible/plugins/connections/chroot.py rename to lib/ansible/plugins/connection/chroot.py index f99be93bac..6ef3a61cb5 100644 --- a/lib/ansible/plugins/connections/chroot.py +++ b/lib/ansible/plugins/connection/chroot.py @@ -27,7 +27,7 @@ import traceback from ansible import constants as C from ansible.errors import AnsibleError -from ansible.plugins.connections import ConnectionBase +from ansible.plugins.connection import ConnectionBase from ansible.utils.path import is_executable from ansible.utils.unicode import to_bytes diff --git a/lib/ansible/plugins/connections/docker.py b/lib/ansible/plugins/connection/docker.py similarity index 99% rename from lib/ansible/plugins/connections/docker.py rename to lib/ansible/plugins/connection/docker.py index 0168f96fbe..1103327470 100644 --- a/lib/ansible/plugins/connections/docker.py +++ b/lib/ansible/plugins/connection/docker.py @@ -31,7 +31,7 @@ from distutils.version import LooseVersion import ansible.constants as C from ansible import errors -from ansible.plugins.connections import ConnectionBase +from ansible.plugins.connection import ConnectionBase BUFSIZE = 65536 diff --git a/lib/ansible/plugins/connections/funcd.py b/lib/ansible/plugins/connection/funcd.py similarity index 100% rename from lib/ansible/plugins/connections/funcd.py rename to lib/ansible/plugins/connection/funcd.py diff --git a/lib/ansible/plugins/connections/jail.py b/lib/ansible/plugins/connection/jail.py similarity index 100% rename from lib/ansible/plugins/connections/jail.py rename to lib/ansible/plugins/connection/jail.py diff --git a/lib/ansible/plugins/connections/libvirt_lxc.py b/lib/ansible/plugins/connection/libvirt_lxc.py similarity index 100% rename from lib/ansible/plugins/connections/libvirt_lxc.py rename to lib/ansible/plugins/connection/libvirt_lxc.py diff --git a/lib/ansible/plugins/connections/local.py b/lib/ansible/plugins/connection/local.py similarity index 99% rename from lib/ansible/plugins/connections/local.py rename to lib/ansible/plugins/connection/local.py index e307798913..1b5a0efe29 100644 --- a/lib/ansible/plugins/connections/local.py +++ b/lib/ansible/plugins/connection/local.py @@ -28,7 +28,7 @@ import fcntl import ansible.constants as C from ansible.errors import AnsibleError, AnsibleFileNotFound -from ansible.plugins.connections import ConnectionBase +from ansible.plugins.connection import ConnectionBase class Connection(ConnectionBase): ''' Local based connections ''' diff --git a/lib/ansible/plugins/connections/paramiko_ssh.py b/lib/ansible/plugins/connection/paramiko_ssh.py similarity index 99% rename from lib/ansible/plugins/connections/paramiko_ssh.py rename to lib/ansible/plugins/connection/paramiko_ssh.py index 6df6a3ebe0..1960ff8076 100644 --- a/lib/ansible/plugins/connections/paramiko_ssh.py +++ b/lib/ansible/plugins/connection/paramiko_ssh.py @@ -43,7 +43,7 @@ from six import iteritems from ansible import constants as C from ansible.errors import AnsibleError, AnsibleConnectionFailure, AnsibleFileNotFound -from ansible.plugins.connections import ConnectionBase +from ansible.plugins.connection import ConnectionBase from ansible.utils.path import makedirs_safe AUTHENTICITY_MSG=""" diff --git a/lib/ansible/plugins/connections/ssh.py b/lib/ansible/plugins/connection/ssh.py similarity index 99% rename from lib/ansible/plugins/connections/ssh.py rename to lib/ansible/plugins/connection/ssh.py index 38459cf774..c113f538d1 100644 --- a/lib/ansible/plugins/connections/ssh.py +++ b/lib/ansible/plugins/connection/ssh.py @@ -36,7 +36,7 @@ from hashlib import sha1 from ansible import constants as C from ansible.errors import AnsibleError, AnsibleConnectionFailure, AnsibleFileNotFound -from ansible.plugins.connections import ConnectionBase +from ansible.plugins.connection import ConnectionBase from ansible.utils.path import unfrackpath, makedirs_safe class Connection(ConnectionBase): diff --git a/lib/ansible/plugins/connections/winrm.py b/lib/ansible/plugins/connection/winrm.py similarity index 99% rename from lib/ansible/plugins/connections/winrm.py rename to lib/ansible/plugins/connection/winrm.py index 0e19b93ac2..4303a3ca2a 100644 --- a/lib/ansible/plugins/connections/winrm.py +++ b/lib/ansible/plugins/connection/winrm.py @@ -42,7 +42,7 @@ except ImportError: from ansible import constants as C from ansible.errors import AnsibleError, AnsibleConnectionFailure, AnsibleFileNotFound -from ansible.plugins.connections import ConnectionBase +from ansible.plugins.connection import ConnectionBase from ansible.plugins import shell_loader from ansible.utils.path import makedirs_safe from ansible.utils.unicode import to_bytes, to_unicode diff --git a/lib/ansible/plugins/connections/zone.py b/lib/ansible/plugins/connection/zone.py similarity index 100% rename from lib/ansible/plugins/connections/zone.py rename to lib/ansible/plugins/connection/zone.py diff --git a/lib/ansible/plugins/strategies/__init__.py b/lib/ansible/plugins/strategy/__init__.py similarity index 100% rename from lib/ansible/plugins/strategies/__init__.py rename to lib/ansible/plugins/strategy/__init__.py diff --git a/lib/ansible/plugins/strategies/free.py b/lib/ansible/plugins/strategy/free.py similarity index 99% rename from lib/ansible/plugins/strategies/free.py rename to lib/ansible/plugins/strategy/free.py index bdaf77bffd..e44d872fec 100644 --- a/lib/ansible/plugins/strategies/free.py +++ b/lib/ansible/plugins/strategy/free.py @@ -23,7 +23,7 @@ import time from ansible.errors import * from ansible.playbook.included_file import IncludedFile -from ansible.plugins.strategies import StrategyBase +from ansible.plugins.strategy import StrategyBase try: from __main__ import display diff --git a/lib/ansible/plugins/strategies/linear.py b/lib/ansible/plugins/strategy/linear.py similarity index 99% rename from lib/ansible/plugins/strategies/linear.py rename to lib/ansible/plugins/strategy/linear.py index 50b5924104..d1e092b739 100644 --- a/lib/ansible/plugins/strategies/linear.py +++ b/lib/ansible/plugins/strategy/linear.py @@ -27,7 +27,7 @@ from ansible.playbook.block import Block from ansible.playbook.included_file import IncludedFile from ansible.playbook.task import Task from ansible.plugins import action_loader -from ansible.plugins.strategies import StrategyBase +from ansible.plugins.strategy import StrategyBase from ansible.template import Templar try: diff --git a/test/units/plugins/connections/test_connection.py b/test/units/plugins/connections/test_connection.py index aba94b5a61..10fa44216d 100644 --- a/test/units/plugins/connections/test_connection.py +++ b/test/units/plugins/connections/test_connection.py @@ -24,16 +24,16 @@ from six import StringIO from ansible.compat.tests import unittest from ansible.playbook.play_context import PlayContext -from ansible.plugins.connections import ConnectionBase -#from ansible.plugins.connections.accelerate import Connection as AccelerateConnection -#from ansible.plugins.connections.chroot import Connection as ChrootConnection -#from ansible.plugins.connections.funcd import Connection as FuncdConnection -#from ansible.plugins.connections.jail import Connection as JailConnection -#from ansible.plugins.connections.libvirt_lxc import Connection as LibvirtLXCConnection -from ansible.plugins.connections.local import Connection as LocalConnection -from ansible.plugins.connections.paramiko_ssh import Connection as ParamikoConnection -from ansible.plugins.connections.ssh import Connection as SSHConnection -#from ansible.plugins.connections.winrm import Connection as WinRmConnection +from ansible.plugins.connection import ConnectionBase +#from ansible.plugins.connection.accelerate import Connection as AccelerateConnection +#from ansible.plugins.connection.chroot import Connection as ChrootConnection +#from ansible.plugins.connection.funcd import Connection as FuncdConnection +#from ansible.plugins.connection.jail import Connection as JailConnection +#from ansible.plugins.connection.libvirt_lxc import Connection as LibvirtLXCConnection +from ansible.plugins.connection.local import Connection as LocalConnection +from ansible.plugins.connection.paramiko_ssh import Connection as ParamikoConnection +from ansible.plugins.connection.ssh import Connection as SSHConnection +#from ansible.plugins.connection.winrm import Connection as WinRmConnection class TestConnectionBaseClass(unittest.TestCase): diff --git a/test/units/plugins/strategies/test_strategy_base.py b/test/units/plugins/strategies/test_strategy_base.py index eb85b9c771..bf01cf6fcc 100644 --- a/test/units/plugins/strategies/test_strategy_base.py +++ b/test/units/plugins/strategies/test_strategy_base.py @@ -23,7 +23,7 @@ from ansible.compat.tests import unittest from ansible.compat.tests.mock import patch, MagicMock from ansible.errors import AnsibleError, AnsibleParserError -from ansible.plugins.strategies import StrategyBase +from ansible.plugins.strategy import StrategyBase from ansible.executor.task_queue_manager import TaskQueueManager from ansible.executor.task_result import TaskResult diff --git a/test/units/template/test_templar.py b/test/units/template/test_templar.py index f7f22c7532..a029754f6e 100644 --- a/test/units/template/test_templar.py +++ b/test/units/template/test_templar.py @@ -25,7 +25,7 @@ from ansible.compat.tests.mock import patch, MagicMock from ansible import constants as C from ansible.errors import * from ansible.plugins import filter_loader, lookup_loader, module_loader -from ansible.plugins.strategies import SharedPluginLoaderObj +from ansible.plugins.strategy import SharedPluginLoaderObj from ansible.template import Templar from units.mock.loader import DictDataLoader