Ansible 2 doesn't show what a task does without "name:". Can I get the old behavior back (like in Ansible 1.x)?

41 views
Skip to first unread message

Mario R

unread,
Feb 1, 2016, 8:19:13 AM2/1/16
to Ansible Project
Hello

In Ansible 1.x a line like this:
- lineinfile: dest=/root/.bashrc regexp="^export VISUAL=" line="export VISUAL='vim'"

Gives the following output when I execute the playbook:
TASK: [lineinfile dest=/root/.bashrc regexp="^export VISUAL=" line="export VISUAL='vim'"] *** 
ok: [xy]

However, with Ansible 2 this got changed. The exact same line gives the following output when the playbook is executed:
TASK [lineinfile] **************************************************************
ok: [xy]

This is not very helpful. I do realize that I can use "name:" but I'd rather have the old behavior as it always shows me what ansible is doing and not just a name I made up. Is there a setting the get the old behavior back?

Brian Coca

unread,
Feb 1, 2016, 10:21:09 AM2/1/16
to Ansible Project
short answer: no

longer answer:

Ansible pre 1.8 templated names and that behavior is back in 2.0 (it
was a bug that it did not work in 1.8/1.9), this plus the usage of
secrets in some tasks would accidentally disclose information onto the
screen most users want to keep private. So we decided to change the
'default name' of tasks to only be the module instead of the module
and all its parameters and err on the side of safety and security.

This is an example of what we avoid now:
` - shell: echo {{mypassword}} | script.sh`


--
Brian Coca

Mario R

unread,
Feb 4, 2016, 10:20:54 AM2/4/16
to Ansible Project
I understand, thank you very much.
Reply all
Reply to author
Forward
0 new messages