@ -162,6 +162,16 @@ class Task(Base, Conditional, Taggable, Become):
new_ds [ ' args ' ] = args
new_ds [ ' args ' ] = args
new_ds [ ' delegate_to ' ] = delegate_to
new_ds [ ' delegate_to ' ] = delegate_to
# we handle any 'vars' specified in the ds here, as we may
# be adding things to them below (special handling for includes).
# When that deprecated feature is removed, this can be too.
if ' vars ' in ds :
if not isinstance ( ds [ ' vars ' ] , dict ) :
raise AnsibleError ( " vars specified on a task must be a dictionary (got a %s ) " % type ( ds [ ' vars ' ] ) , obj = new_ds )
new_ds [ ' vars ' ] = ds . pop ( ' vars ' )
else :
new_ds [ ' vars ' ] = dict ( )
for ( k , v ) in ds . iteritems ( ) :
for ( k , v ) in ds . iteritems ( ) :
if k in ( ' action ' , ' local_action ' , ' args ' , ' delegate_to ' ) or k == action or k == ' shell ' :
if k in ( ' action ' , ' local_action ' , ' args ' , ' delegate_to ' ) or k == action or k == ' shell ' :
# we don't want to re-assign these values, which were
# we don't want to re-assign these values, which were
@ -169,6 +179,14 @@ class Task(Base, Conditional, Taggable, Become):
continue
continue
elif k . replace ( " with_ " , " " ) in lookup_loader :
elif k . replace ( " with_ " , " " ) in lookup_loader :
self . _preprocess_loop ( ds , new_ds , k , v )
self . _preprocess_loop ( ds , new_ds , k , v )
else :
# pre-2.0 syntax allowed variables for include statements at the
# top level of the task, so we move those into the 'vars' dictionary
# here, and show a deprecation message as we will remove this at
# some point in the future.
if action == ' include ' and k not in self . _get_base_attributes ( ) :
self . _display . deprecated ( " Specifying include variables at the top-level of the task is deprecated. Please see: \n http://docs.ansible.com/ansible/playbooks_roles.html#task-include-files-and-encouraging-reuse \n \n for currently supported syntax regarding included files and variables " )
new_ds [ ' vars ' ] [ k ] = v
else :
else :
new_ds [ k ] = v
new_ds [ k ] = v