4

Is it possible to list the tasks in an Ansible role?

i.e. other than just grepping for - name, is there an out-of-the-box way of doing this?

techraf
  • 64,883
  • 27
  • 193
  • 198
Snowcrash
  • 80,579
  • 89
  • 266
  • 376

2 Answers2

8

Create a simple playbook specifying the role and execute ansible-playbook with --list-tasks option.

But this will not list the tasks in dynamically included files.

techraf
  • 64,883
  • 27
  • 193
  • 198
0

You need to identify the play to display. ex:

ansible-playbook --list-tasks my-play.yml

And tasks in roles imported with include_role will not be displayed. As @techraf said, this is dynamically loaded.

4t8dds
  • 565
  • 7
  • 19