Hi all,
Is there a way to get the current task name?
With this example plyabook, I got an undefined “name” variable
- hosts: all
tasks:
- name: Dump all vars
debug:
msg: “echo task name is {{ name }}”
Error message is
ansible-playbook -i inventory/local dumpall.yml
PLAY [all] **********************************************************************************************************************************************************************************
TASK [Gathering Facts] **********************************************************************************************************************************************************************
ok: [localhost]TASK [Dump all vars] ************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {“msg”: “The task includes an option with an undefined variable. The error was: ‘name’ is undefined\n\nThe error appears to have been in ‘dumpall.yml’: line 7, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n tasks:\n - name: Dump all vars\n ^ here\n”}
to retry, use: --limit @dumpall.retryPLAY RECAP **********************************************************************************************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=1
inventory/local:
[local]
localhost ansible_connection=local
My environement:
- debian 9
- ansible 2.7.5 in virtualenv
Thanks
Lionel