Trying to do something that seems straightforward but can't work out why 
its failing.

I'm simply trying to pass a random server within a  group whose name is 
supplied at execution time to a task using "delegate_to" and  
"--extra-vars" but it doesn't like it i.e


  delegate_to: {{ groups.v_grp | random }}
>
>   

followed by:

  
ansible-playbook playbook.yml --extra-vars="{{ v_grp=testgrp }}" 



Execution throws up the below error. 

fatal: [machine1]: FAILED! => {"msg": "'dict object' has no attribute 
'v_grp'"}


The group does exist and the playbook actually executes when the group name 
testgrp is hard coded. Unfortunately, the idea is to be able to pass group 
names in dynamically at runtime

I've trawled through the web for any hints around getting this working but 
there's been no luck. The closes I found was a suggestion on another  
thread (dated 2014) but it didn't work either 
https://groups.google.com/forum/#!topic/ansible-project/wfsS1b8Qq64

I'm assuming this is definitely possible in ansible?


Thanks
Dayo

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/eba1c394-c757-4b1e-add8-11316d0bd62e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to