Strategy plugins control the flow of play execution by handling task and host scheduling.
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 ansible.cfg.
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 linear plugin. You can change this default in Ansible configuration using an environment variable:
or in the
You can also specify the strategy plugin in the play via the strategy keyword in a play:
- 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
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.
An introduction to playbooks
Ansible inventory plugins
Ansible callback plugins
Jinja2 filter plugins
Jinja2 test plugins
Jinja2 lookup plugins
Have a question? Stop by the google group!
#ansible IRC chat channel
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.