Possible to have --list-tasks be aware of variable names?

68 views
Skip to first unread message

Marc Abramowitz

unread,
Sep 19, 2014, 9:32:25 AM9/19/14
to ansible...@googlegroups.com
I have this playbook:

---
- hosts: localhost
  roles:
    - { role: webserver, tags: ['webserver'], app_role: 'webserver' }
    - { role: dbserver, tags: ['dbserver'], app_role: 'dbserver' }

The two roles have a task with a "name" that has "{{ app_role }}" in it. E.g.:

$ cat roles/webserver/tasks/main.yml
---
- name: "Show this is the {{ app_role }} role"
  debug: msg="This is the webserver role"

If I execute the playbook normally, ansible shows the task names with the variable substituted in, which is great:

TASK: [webserver | Show this is the webserver role]
TASK: [dbserver | Show this is the dbserver role]

But with --list-tasks, it doesn't do the variable substitution:

$ ansible-playbook role_tags.yml --tags=dbserver,webserver --list-tasks

playbook: role_tags.yml

  play #1 (localhost):
    Show this is the {{ app_role }} role
    Show this is the {{ app_role }} role

Is it possible to get ansible to display the name with the variable substitutions applied when running with --list-tasks?

Thanks!

Marc

Michael DeHaan

unread,
Sep 21, 2014, 3:50:32 PM9/21/14
to ansible...@googlegroups.com
Technically possible, but perhaps a little frustrating to implement :)

We'd be happy if someone wanted to take a crack at it, though I think in general we're waiting for some refactoring to happen first so there's more one common entity to ask about variable "context" questions before going at it.

(It should be noted that inventory variables, because they can be different per host, will also never show up in task names)



--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/82be82bf-e791-4419-86e0-936f96c2ca78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mumshad Mannambeth

unread,
Dec 11, 2016, 8:20:02 PM12/11/16
to Ansible Project
Hi Michael,

Any update on this? Has this been implemented since the original post? or are there any plans now?

Thanks
Mumshad
Reply all
Reply to author
Forward
0 new messages