Reusing tasks in Ansible

You can do so by either using roles: http://www.ansibleworks.com/docs/playbooks_roles.html

or by tagging individual tasks you want to be able to turn off: http://www.ansibleworks.com/docs/playbooks_tags.html

You can even combine the two, as described on the tags page:

You may also apply tags to roles:

roles:
  - { role: webserver, port: 5000, tags: [ 'web', 'foo' ] }