[DEPRECATION WARNING]: Skipping task due to undefined Error

228 views
Skip to first unread message

Julien Tognazzi

unread,
Apr 21, 2016, 7:59:32 AM4/21/16
to Ansible Project
Hi,

running the following play generate this not so useful DEPRECATION WARNING
---
- hosts: localhost


  vars
:
#  - mounts:
#    - '1'
#    - '2'


  tasks
:
 
- name: "Tasks generating fatal error"
    debug
: var=mounts
    with_items
:
     
- "{{ mounts }}"
   
when: mounts is defined
    tags
: "mounts"

$ ansible --version
ansible
2.0.1.0
  config file
= /vagrant/sysadmin/ansible/coremedia7/ansible.cfg
  configured
module search path = Default w/o overrides


$ ansible-playbook fatal.yml
 
[WARNING]: provided hosts list is empty, only localhost is available




PLAY
***************************************************************************


TASK
[Tasks generating fatal error] ********************************************
Thursday 21 April 2016  13:47:46 +0200 (0:00:00.034)       0:00:00.034 ********
[DEPRECATION WARNING]: Skipping task due to undefined Error, in the future this will be a fatal
error
.. This feature will be removed in a future release. Deprecation warnings can be disabled by
setting deprecation_warnings
=False in ansible.cfg.

It only happen if the mount variable is undefined...
But the when clause should prevent it to run, isn't it ?
What am I missing ?

Should I file an issue for this ?

thanks for any tips.

Julien.

Julien Tognazzi

unread,
Apr 21, 2016, 8:03:58 AM4/21/16
to Ansible Project
I forgot to add that if using the bare variable with with_items, it doesn't generate the previous warning.

Matt Martz

unread,
Apr 21, 2016, 8:04:09 AM4/21/16
to ansible...@googlegroups.com
`when` statements run for every iteration of the `with_` loop, not before the loop is evaluated.
--
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/e458e63d-2b4f-4f51-b941-e1be33697ad7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Matt Martz
@sivel
sivel.net

Reply all
Reply to author
Forward
0 new messages