@ -12,19 +14,19 @@ The 'normal' action plugin is used for modules that do not already have an actio
.._enabling_action:
.._enabling_action:
Enabling Action Plugins
Enabling action plugins
-----------------------
-----------------------
You can enable a custom action plugin by either dropping it into the ``action_plugins`` directory adjacent to your play, inside a role, or by putting it in one of the action plugin directory sources configured in :ref:`ansible.cfg <ansible_configuration_settings>`.
You can enable a custom action plugin by either dropping it into the ``action_plugins`` directory adjacent to your play, inside a role, or by putting it in one of the action plugin directory sources configured in :ref:`ansible.cfg <ansible_configuration_settings>`.
.._using_action:
.._using_action:
Using Action Plugins
Using action plugins
--------------------
--------------------
Action plugin are executed by default when an associated module is used; no action is required.
Action plugin are executed by default when an associated module is used; no action is required.
Plugin List
Plugin list
-----------
-----------
You cannot list action plugins directly, they show up as their counterpart modules:
You cannot list action plugins directly, they show up as their counterpart modules:
@ -34,19 +36,19 @@ Use ``ansible-doc <name>`` to see specific documentation and examples, this shou
..seealso::
..seealso::
:doc:`cache`
:ref:`cache_plugins`
Ansible Cache plugins
Ansible Cache plugins
:doc:`callback`
:ref:`callback_plugins`
Ansible callback plugins
Ansible callback plugins
:doc:`connection`
:ref:`connection_plugins`
Ansible connection plugins
Ansible connection plugins
:doc:`inventory`
:ref:`inventory_plugins`
Ansible inventory plugins
Ansible inventory plugins
:doc:`shell`
:ref:`shell_plugins`
Ansible Shell plugins
Ansible Shell plugins
:doc:`strategy`
:ref:`strategy_plugins`
Ansible Strategy plugins
Ansible Strategy plugins
:doc:`vars`
:ref:`vars_plugins`
Ansible Vars plugins
Ansible Vars plugins
`User Mailing List <https://groups.google.com/group/ansible-devel>`_
`User Mailing List <https://groups.google.com/group/ansible-devel>`_
Cache plugin implement a backend caching mechanism that allows Ansible to store gathered facts or inventory source data
Cache plugin implement a backend caching mechanism that allows Ansible to store gathered facts or inventory source data
without the performance hit of retrieving them from source.
without the performance hit of retrieving them from source.
The default cache plugin is the :doc:`memory <cache/memory>` plugin, which only caches the data for the current execution of Ansible. Other plugins with persistent storage are available to allow caching the data across runs.
The default cache plugin is the :ref:`memory <memory_cache>` plugin, which only caches the data for the current execution of Ansible. Other plugins with persistent storage are available to allow caching the data across runs.
You can use a separate cache plugin for inventory and facts. If an inventory-specific cache plugin is not provided and inventory caching is enabled, the fact cache plugin is used for inventory.
You can use a separate cache plugin for inventory and facts. If an inventory-specific cache plugin is not provided and inventory caching is enabled, the fact cache plugin is used for inventory.
@ -110,19 +113,19 @@ Use ``ansible-doc -t cache <plugin name>`` to see specific documentation and exa
..seealso::
..seealso::
:doc:`action`
:ref:`action_plugins`
Ansible Action plugins
Ansible Action plugins
:doc:`callback`
:ref:`callback_plugins`
Ansible callback plugins
Ansible callback plugins
:doc:`connection`
:ref:`connection_plugins`
Ansible connection plugins
Ansible connection plugins
:doc:`inventory`
:ref:`inventory_plugins`
Ansible inventory plugins
Ansible inventory plugins
:doc:`shell`
:ref:`shell_plugins`
Ansible Shell plugins
Ansible Shell plugins
:doc:`strategy`
:ref:`strategy_plugins`
Ansible Strategy plugins
Ansible Strategy plugins
:doc:`vars`
:ref:`vars_plugins`
Ansible Vars plugins
Ansible Vars plugins
`User Mailing List <https://groups.google.com/forum/#!forum/ansible-devel>`_
`User Mailing List <https://groups.google.com/forum/#!forum/ansible-devel>`_
Callback plugins enable adding new behaviors to Ansible when responding to events.
Callback plugins enable adding new behaviors to Ansible when responding to events.
By default, callback plugins control most of the output you see when running the command line programs,
By default, callback plugins control most of the output you see when running the command line programs,
@ -10,19 +13,18 @@ but can also be used to add additional output, integrate with other tools and ma
.._callback_examples:
.._callback_examples:
Example Callback Plugins
Example callback plugins
++++++++++++++++++++++++
------------------------
The :doc:`log_plays <callback/log_plays>` callback is an example of how to record playbook events to a log file,
and the :doc:`mail <callback/mail>` callback sends email on playbook failures.
The :doc:`osx_say <callback/osx_say>` callback responds with computer synthesized speech on macOS in relation to playbook events.
The :ref:`log_plays <log_plays_callback>` callback is an example of how to record playbook events to a log file,
and the :ref:`mail <mail_callback>` callback sends email on playbook failures.
The :ref:`osx_say <osx_say_callback>` callback responds with computer synthesized speech on macOS in relation to playbook events.
.._enabling_callbacks:
.._enabling_callbacks:
Enabling Callback Plugins
Enabling callback plugins
++++++++++++++++++++++++++
-------------------------
You can activate a custom callback by either dropping it into a ``callback_plugins`` directory adjacent to your play, inside a role, or by putting it in one of the callback directory sources configured in :ref:`ansible.cfg <ansible_configuration_settings>`.
You can activate a custom callback by either dropping it into a ``callback_plugins`` directory adjacent to your play, inside a role, or by putting it in one of the callback directory sources configured in :ref:`ansible.cfg <ansible_configuration_settings>`.
@ -34,9 +36,8 @@ Most callbacks shipped with Ansible are disabled by default and need to be white
#callback_whitelist = timer, mail, profile_roles
#callback_whitelist = timer, mail, profile_roles
Setting a callback plugin for ``ansible-playbook``
You can only have one plugin be the main manager of your console output. If you want to replace the default, you should define CALLBACK_TYPE = stdout in the subclass and then configure the stdout plugin in :ref:`ansible.cfg <ansible_configuration_settings>`. For example:
You can only have one plugin be the main manager of your console output. If you want to replace the default, you should define CALLBACK_TYPE = stdout in the subclass and then configure the stdout plugin in :ref:`ansible.cfg <ansible_configuration_settings>`. For example:
@ -52,8 +53,8 @@ or for my custom callback:
This only affects :ref:`ansible-playbook` by default.
This only affects :ref:`ansible-playbook` by default.
Managing AdHoc
Setting a callback plugin for ad-hoc commands
``````````````
---------------------------------------------
The :ref:`ansible` ad hoc command specifically uses a different callback plugin for stdout,
The :ref:`ansible` ad hoc command specifically uses a different callback plugin for stdout,
so there is an extra setting in :ref:`ansible_configuration_settings` you need to add to use the stdout callback defined above:
so there is an extra setting in :ref:`ansible_configuration_settings` you need to add to use the stdout callback defined above:
@ -72,13 +73,12 @@ You can also set this as an environment variable:
.._callback_plugin_list:
.._callback_plugin_list:
Plugin List
Plugin list
+++++++++++
-----------
You can use ``ansible-doc -t callback -l`` to see the list of available plugins.
You can use ``ansible-doc -t callback -l`` to see the list of available plugins.
Use ``ansible-doc -t callback <plugin name>`` to see specific documents and examples.
Use ``ansible-doc -t callback <plugin name>`` to see specific documents and examples.
..toctree:: :maxdepth: 1
..toctree:: :maxdepth: 1
:glob:
:glob:
@ -87,19 +87,19 @@ Use ``ansible-doc -t callback <plugin name>`` to see specific documents and exam
..seealso::
..seealso::
:doc:`action`
:ref:`action_plugins`
Ansible Action plugins
Ansible Action plugins
:doc:`cache`
:ref:`cache_plugins`
Ansible cache plugins
Ansible cache plugins
:doc:`connection`
:ref:`connection_plugins`
Ansible connection plugins
Ansible connection plugins
:doc:`inventory`
:ref:`inventory_plugins`
Ansible inventory plugins
Ansible inventory plugins
:doc:`shell`
:ref:`shell_plugins`
Ansible Shell plugins
Ansible Shell plugins
:doc:`strategy`
:ref:`strategy_plugins`
Ansible Strategy plugins
Ansible Strategy plugins
:doc:`vars`
:ref:`vars_plugins`
Ansible Vars plugins
Ansible Vars plugins
`User Mailing List <https://groups.google.com/forum/#!forum/ansible-devel>`_
`User Mailing List <https://groups.google.com/forum/#!forum/ansible-devel>`_
Connection plugins allow Ansible to connect to the target hosts so it can execute tasks on them. Ansible ships with many connection plugins, but only one can be used per host at a time.
Connection plugins allow Ansible to connect to the target hosts so it can execute tasks on them. Ansible ships with many connection plugins, but only one can be used per host at a time.
@ -11,28 +15,28 @@ The basics of these connection types are covered in the :ref:`getting started<in
.._ssh_plugins:
.._ssh_plugins:
ssh Plugins
``ssh`` plugins
+++++++++++
---------------
Because ssh is the default protocol used in system administration and the protocol most used in Ansible, ssh options are included in the command line tools. See :ref:`ansible-playbook` for more details.
Because ssh is the default protocol used in system administration and the protocol most used in Ansible, ssh options are included in the command line tools. See :ref:`ansible-playbook` for more details.
.._enabling_connection:
.._enabling_connection:
Enabling Connection Plugins
Adding connection plugins
+++++++++++++++++++++++++++
-------------------------
You can extend Ansible to support other transports (such as SNMP or message bus) by dropping a custom plugin
You can extend Ansible to support other transports (such as SNMP or message bus) by dropping a custom plugin
into the ``connection_plugins`` directory.
into the ``connection_plugins`` directory.
.._using_connection:
.._using_connection:
Using Connection Plugins
Using connection plugins
++++++++++++++++++++++++
------------------------
The transport can be changed via :ref:`configuration<ansible_configuration_settings>`, at the command line (``-c``, ``--connection``), as a :ref:`keyword <playbook_keywords>` in your play, or by setting a :ref:`variable<behavioral_parameters>`, most often in your inventory.
You can set the connection plugin globally via :ref:`configuration<ansible_configuration_settings>`, at the command line (``-c``, ``--connection``), as a :ref:`keyword <playbook_keywords>` in your play, or by setting a :ref:`variable<behavioral_parameters>`, most often in your inventory.
For example, for Windows machines you might want to use the :doc:`winrm<connection/winrm>` plugin.
For example, for Windows machines you might want to set the :ref:`winrm <winrm_connection>` plugin as an inventory variable.
Most connection plugins can operate with a minimum configuration. By default they use the :ref:`inventory hostname<inventory_hostnames_lookup>` and defaults to find the target host.
Most connection plugins can operate with minimal configuration. By default they use the :ref:`inventory hostname<inventory_hostnames_lookup>` and defaults to find the target host.
Plugins are self-documenting. Each plugin should document its configuration options. The following are connection variables common to most connection plugins:
Plugins are self-documenting. Each plugin should document its configuration options. The following are connection variables common to most connection plugins:
@ -48,7 +52,7 @@ Each plugin might also have a specific version of a variable that overrides the
.._connection_plugin_list:
.._connection_plugin_list:
Plugin List
Plugin List
+++++++++++
-----------
You can use ``ansible-doc -t connection -l`` to see the list of available plugins.
You can use ``ansible-doc -t connection -l`` to see the list of available plugins.
Use ``ansible-doc -t connection <plugin name>`` to see detailed documentation and examples.
Use ``ansible-doc -t connection <plugin name>`` to see detailed documentation and examples.
@ -64,7 +68,7 @@ Use ``ansible-doc -t connection <plugin name>`` to see detailed documentation an
:ref:`Working with Playbooks<working_with_playbooks>`
:ref:`Working with Playbooks<working_with_playbooks>`
An introduction to playbooks
An introduction to playbooks
:doc:`callback`
:ref:`callback_plugins`
Ansible callback plugins
Ansible callback plugins
:ref:`Filters<playbooks_filters>`
:ref:`Filters<playbooks_filters>`
Jinja2 filter plugins
Jinja2 filter plugins
@ -72,7 +76,7 @@ Use ``ansible-doc -t connection <plugin name>`` to see detailed documentation an
Jinja2 test plugins
Jinja2 test plugins
:ref:`Lookups<playbooks_lookups>`
:ref:`Lookups<playbooks_lookups>`
Jinja2 lookup plugins
Jinja2 lookup plugins
:doc:`vars`
:ref:`vars_plugins`
Ansible vars plugins
Ansible vars plugins
`User Mailing List <https://groups.google.com/group/ansible-devel>`_
`User Mailing List <https://groups.google.com/group/ansible-devel>`_
Inventory plugins allow users to point at data sources to compile the inventory of hosts that Ansible uses to target tasks, either via the ``-i /path/to/file`` and/or ``-i 'host1, host2'`` command line parameters or from other configuration sources.
Inventory plugins allow users to point at data sources to compile the inventory of hosts that Ansible uses to target tasks, either via the ``-i /path/to/file`` and/or ``-i 'host1, host2'`` command line parameters or from other configuration sources.
.._enabling_inventory:
.._enabling_inventory:
Enabling Inventory Plugins
Enabling inventory plugins
--------------------------
--------------------------
Most inventory plugins shipped with Ansible are disabled by default and need to be whitelisted in your
Most inventory plugins shipped with Ansible are disabled by default and need to be whitelisted in your
@ -32,7 +34,7 @@ This list also establishes the order in which each plugin tries to parse an inve
.._using_inventory:
.._using_inventory:
Using Inventory Plugins
Using inventory plugins
-----------------------
-----------------------
The only requirement for using an inventory plugin after it is enabled is to provide an inventory source to parse.
The only requirement for using an inventory plugin after it is enabled is to provide an inventory source to parse.
@ -121,9 +123,9 @@ Use ``ansible-doc -t inventory <plugin name>`` to see plugin-specific documentat
:ref:`about_playbooks`
:ref:`about_playbooks`
An introduction to playbooks
An introduction to playbooks
:doc:`callback`
:ref:`callback_plugins`
Ansible callback plugins
Ansible callback plugins
:doc:`connection`
:ref:`connection_plugins`
Ansible connection plugins
Ansible connection plugins
:ref:`playbooks_filters`
:ref:`playbooks_filters`
Jinja2 filter plugins
Jinja2 filter plugins
@ -131,7 +133,7 @@ Use ``ansible-doc -t inventory <plugin name>`` to see plugin-specific documentat
Jinja2 test plugins
Jinja2 test plugins
:ref:`playbooks_lookups`
:ref:`playbooks_lookups`
Jinja2 lookup plugins
Jinja2 lookup plugins
:doc:`vars`
:ref:`vars_plugins`
Ansible vars plugins
Ansible vars plugins
`User Mailing List <https://groups.google.com/group/ansible-devel>`_
`User Mailing List <https://groups.google.com/group/ansible-devel>`_
Lookup plugins allow Ansible to access data from outside sources.
Lookup plugins allow Ansible to access data from outside sources.
This can include reading the filesystem in addition to contacting external datastores and services.
This can include reading the filesystem in addition to contacting external datastores and services.
@ -26,16 +28,16 @@ Lookups are an Ansible-specific extension to the Jinja2 templating language.
.._enabling_lookup:
.._enabling_lookup:
Enabling Lookup Plugins
Enabling lookup plugins
+++++++++++++++++++++++
-----------------------
You can activate a custom lookup by either dropping it into a ``lookup_plugins`` directory adjacent to your play, inside a role, or by putting it in one of the lookup directory sources configured in :ref:`ansible.cfg <ansible_configuration_settings>`.
You can activate a custom lookup by either dropping it into a ``lookup_plugins`` directory adjacent to your play, inside a role, or by putting it in one of the lookup directory sources configured in :ref:`ansible.cfg <ansible_configuration_settings>`.
.._using_lookup:
.._using_lookup:
Using Lookup Plugins
Using lookup plugins
++++++++++++++++++++
--------------------
Lookup plugins can be used anywhere you can use templating in Ansible: in a play, in variables file, or in a Jinja2 template for the :ref:`template <template_module>` module.
Lookup plugins can be used anywhere you can use templating in Ansible: in a play, in variables file, or in a Jinja2 template for the :ref:`template <template_module>` module.
@ -45,7 +47,7 @@ Lookup plugins can be used anywhere you can use templating in Ansible: in a play
Lookups are an integral part of loops. Wherever you see ``with_``, the part after the underscore is the name of a lookup.
Lookups are an integral part of loops. Wherever you see ``with_``, the part after the underscore is the name of a lookup.
This is also the reason most lookups output lists and take lists as input; for example, ``with_items`` uses the :doc:`items <lookup/items>` lookup:
This is also the reason most lookups output lists and take lists as input; for example, ``with_items`` uses the :ref:`items <items_lookup>` lookup:
..code-block:: yaml
..code-block:: yaml
@ -108,15 +110,15 @@ Fatal error (the default)::
.._query:
.._query:
query
Invoking lookup plugins with ``query``
+++++
--------------------------------------
..versionadded:: 2.5
..versionadded:: 2.5
In Ansible 2.5, a new jinja2 function called ``query`` was added for invoking lookup plugins. The difference between ``lookup`` and ``query`` is largely that ``query`` will always return a list.
In Ansible 2.5, a new jinja2 function called ``query`` was added for invoking lookup plugins. The difference between ``lookup`` and ``query`` is largely that ``query`` will always return a list.
The default behavior of ``lookup`` is to return a string of comma separated values. ``lookup`` can be explicitly configured to return a list using ``wantlist=True``.
The default behavior of ``lookup`` is to return a string of comma separated values. ``lookup`` can be explicitly configured to return a list using ``wantlist=True``.
This was done primarily to provide an easier and more consistent interface for interacting with the new ``loop`` keyword, while maintaining backwards compatibiltiy with other uses of ``lookup``.
This was done primarily to provide an easier and more consistent interface for interacting with the new ``loop`` keyword, while maintaining backwards compatibility with other uses of ``lookup``.
The following examples are equivalent::
The following examples are equivalent::
@ -133,8 +135,8 @@ Additionally, ``q`` was introduced as a shortform of ``query``::
.._lookup_plugins_list:
.._lookup_plugins_list:
Plugin List
Plugin list
+++++++++++
-----------
You can use ``ansible-doc -t lookup -l`` to see the list of available plugins. Use ``ansible-doc -t lookup <plugin name>`` to see specific documents and examples.
You can use ``ansible-doc -t lookup -l`` to see the list of available plugins. Use ``ansible-doc -t lookup <plugin name>`` to see specific documents and examples.
@ -148,9 +150,9 @@ You can use ``ansible-doc -t lookup -l`` to see the list of available plugins. U
Strategy plugins control the flow of play execution by handling task and host scheduling.
Strategy plugins control the flow of play execution by handling task and host scheduling.
.._enable_strategy:
.._enable_strategy:
Enabling Strategy Plugins
Enabling strategy plugins
+++++++++++++++++++++++++
-------------------------
Strategy plugins shipped with Ansible are enabled by default. You can enable a custom strategy plugin by
All strategy plugins shipped with Ansible are enabled by default. You can enable a custom strategy plugin by
putting it in one of the lookup directory sources configured in :ref:`ansible.cfg <ansible_configuration_settings>`.
putting it in one of the lookup directory sources configured in :ref:`ansible.cfg <ansible_configuration_settings>`.
.._using_strategy:
.._using_strategy:
Using Strategy Plugins
Using strategy plugins
++++++++++++++++++++++
----------------------
Only one strategy plugin can be used in a play, but you can use different ones for each play in a playbook or ansible run.
Only one strategy plugin can be used in a play, but you can use different ones for each play in a playbook or ansible run.
The default is the :doc:`linear <strategy/linear>` plugin. You can change this default in Ansible :ref:`configuration <ansible_configuration_settings>` using an environment variable:
The default is the :ref:`linear <linear_strategy>` plugin. You can change this default in Ansible :ref:`configuration <ansible_configuration_settings>` using an environment variable:
..code-block:: shell
..code-block:: shell
@ -50,8 +52,8 @@ You can also specify the strategy plugin in the play via the :ref:`strategy keyw
.._strategy_plugin_list:
.._strategy_plugin_list:
Plugin List
Plugin list
+++++++++++
-----------
You can use ``ansible-doc -t strategy -l`` to see the list of available plugins.
You can use ``ansible-doc -t strategy -l`` to see the list of available plugins.
Use ``ansible-doc -t strategy <plugin name>`` to see plugin-specific specific documentation and examples.
Use ``ansible-doc -t strategy <plugin name>`` to see plugin-specific specific documentation and examples.
@ -66,9 +68,9 @@ Use ``ansible-doc -t strategy <plugin name>`` to see plugin-specific specific do
Vars plugins inject additional variable data into Ansible runs that did not come from an inventory source, playbook, or command line. Playbook constructs like 'host_vars' and 'group_vars' work using vars plugins.
Vars plugins inject additional variable data into Ansible runs that did not come from an inventory source, playbook, or command line. Playbook constructs like 'host_vars' and 'group_vars' work using vars plugins.
@ -13,16 +16,16 @@ The :ref:`host_group_vars <host_group_vars_vars>` plugin shipped with Ansible en
.._enable_vars:
.._enable_vars:
Enabling Vars Plugins
Enabling vars plugins
+++++++++++++++++++++
---------------------
You can activate a custom vars plugin by either dropping it into a ``vars_plugins`` directory adjacent to your play, inside a role, or by putting it in one of the directory sources configured in :ref:`ansible.cfg <ansible_configuration_settings>`.
You can activate a custom vars plugin by either dropping it into a ``vars_plugins`` directory adjacent to your play, inside a role, or by putting it in one of the directory sources configured in :ref:`ansible.cfg <ansible_configuration_settings>`.
.._using_vars:
.._using_vars:
Using Vars Plugins
Using vars plugins
++++++++++++++++++
------------------
Vars plugins are used automatically after they are enabled.
Vars plugins are used automatically after they are enabled.
@ -30,7 +33,7 @@ Vars plugins are used automatically after they are enabled.
.._vars_plugin_list:
.._vars_plugin_list:
Plugin Lists
Plugin Lists
++++++++++++
------------
You can use ``ansible-doc -t vars -l`` to see the list of available plugins.
You can use ``ansible-doc -t vars -l`` to see the list of available plugins.
Use ``ansible-doc -t vars <plugin name>`` to see specific plugin-specific documentation and examples.
Use ``ansible-doc -t vars <plugin name>`` to see specific plugin-specific documentation and examples.
@ -43,19 +46,19 @@ Use ``ansible-doc -t vars <plugin name>`` to see specific plugin-specific docume
..seealso::
..seealso::
:doc:`action`
:ref:`action_plugins`
Ansible Action plugins
Ansible Action plugins
:doc:`cache`
:ref:`cache_plugins`
Ansible Cache plugins
Ansible Cache plugins
:doc:`callback`
:ref:`callback_plugins`
Ansible callback plugins
Ansible callback plugins
:doc:`connection`
:ref:`connection_plugins`
Ansible connection plugins
Ansible connection plugins
:doc:`inventory`
:ref:`inventory_plugins`
Ansible inventory plugins
Ansible inventory plugins
:doc:`shell`
:ref:`shell_plugins`
Ansible Shell plugins
Ansible Shell plugins
:doc:`strategy`
:ref:`strategy_plugins`
Ansible Strategy plugins
Ansible Strategy plugins
`User Mailing List <https://groups.google.com/group/ansible-devel>`_
`User Mailing List <https://groups.google.com/group/ansible-devel>`_