2018-11-29 20:03:00 +00:00
.. _strategy_plugins:
2017-09-23 03:19:50 +00:00
Strategy Plugins
2018-11-29 20:03:00 +00:00
================
.. contents ::
:local:
:depth: 2
2017-09-23 03:19:50 +00:00
2017-09-25 22:37:33 +00:00
Strategy plugins control the flow of play execution by handling task and host scheduling.
2017-09-23 03:19:50 +00:00
2017-10-11 04:15:25 +00:00
.. _enable_strategy:
2017-09-23 03:19:50 +00:00
2018-11-29 20:03:00 +00:00
Enabling strategy plugins
-------------------------
2017-09-23 03:19:50 +00:00
2018-11-29 20:03:00 +00:00
All strategy plugins shipped with Ansible are enabled by default. You can enable a custom strategy plugin by
2018-04-20 00:02:30 +00:00
putting it in one of the lookup directory sources configured in :ref: `ansible.cfg <ansible_configuration_settings>` .
2017-10-11 04:15:25 +00:00
.. _using_strategy:
2018-11-29 20:03:00 +00:00
Using strategy plugins
----------------------
2017-10-11 04:15:25 +00:00
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.
2018-11-29 20:03:00 +00:00
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:
2017-09-23 03:19:50 +00:00
.. code-block :: shell
export ANSIBLE_STRATEGY=free
or in the `ansible.cfg` file:
.. code-block :: ini
[defaults]
strategy=linear
2018-04-27 18:21:39 +00:00
You can also specify the strategy plugin in the play via the :ref: `strategy keyword <playbook_keywords>` in a play::
2017-09-23 03:19:50 +00:00
- hosts: all
strategy: debug
tasks:
- copy: src=myhosts dest=/etc/hosts
notify: restart_tomcat
- package: name=tomcat state=present
handlers:
- name: restart_tomcat
service: name=tomcat state=restarted
2017-10-11 04:15:25 +00:00
.. _strategy_plugin_list:
2017-09-23 03:19:50 +00:00
2018-11-29 20:03:00 +00:00
Plugin list
-----------
2017-09-23 03:19:50 +00:00
2018-11-29 20:03:00 +00:00
You can use `` ansible-doc -t strategy -l `` to see the list of available plugins.
2017-09-25 22:37:33 +00:00
Use `` ansible-doc -t strategy <plugin name> `` to see plugin-specific specific documentation and examples.
2017-09-23 03:19:50 +00:00
.. toctree :: :maxdepth: 1
:glob:
strategy/*
.. seealso ::
2018-04-20 00:02:30 +00:00
:ref: `about_playbooks`
2017-09-23 03:19:50 +00:00
An introduction to playbooks
2018-11-29 20:03:00 +00:00
:ref: `inventory_plugins`
2017-09-23 03:19:50 +00:00
Ansible inventory plugins
2018-11-29 20:03:00 +00:00
:ref: `callback_plugins`
2017-09-23 03:19:50 +00:00
Ansible callback plugins
2018-04-20 00:02:30 +00:00
:ref: `playbooks_filters`
2017-09-23 03:19:50 +00:00
Jinja2 filter plugins
2018-04-20 00:02:30 +00:00
:ref: `playbooks_tests`
2017-09-23 03:19:50 +00:00
Jinja2 test plugins
2018-04-20 00:02:30 +00:00
:ref: `playbooks_lookups`
2017-09-23 03:19:50 +00:00
Jinja2 lookup plugins
2018-07-21 13:48:47 +00:00
`User Mailing List <https://groups.google.com/group/ansible-devel> `_
2017-09-23 03:19:50 +00:00
Have a question? Stop by the google group!
`irc.freenode.net <http://irc.freenode.net> `_
#ansible IRC chat channel