Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Ansible, is it possible to define a set of tasks in one files and then run selected tasks from other playbooks? The documentation describes how to include and reuse the task list, is there a way to run only selected tasks and not the full list?

share|improve this question
up vote 7 down vote accepted

You can do so by either using roles:

or by tagging individual tasks you want to be able to turn off:

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

You may also apply tags to roles:

  - { role: webserver, port: 5000, tags: [ 'web', 'foo' ] }
share|improve this answer
There is no way for a playbook to invoke specific tags in another role or playbook. The only way to filter by tags is on the command line. – augurar Aug 25 '15 at 17:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.