When I’m registering the ec2 var isn’t results suppose to be automatically defined as the results of what was registered in the variable. I’m getting this when trying to debug the ec2.results var:
TASK [debug ec2 var] ***********************************************************
Monday 23 May 2016 11:14:18 -0500 (0:00:38.587) 0:00:43.306 ************
ok: [aaa-frs-ans-test1] => {
“ec2.results”: “VARIABLE IS NOT DEFINED!”
}
ok: [aaa-frs-ans-test2] => {
“ec2.results”: “VARIABLE IS NOT DEFINED!”
}
Here’s my creation task:
hosts: ec2_instances
connection: local
gather_facts: true
tasks:
They launch fine and if I debug ec2.instances I get all the info from that variable. Also when I debug just ec2 I get all the info as well. I did see though that when I debug just ec2 there isn’t a .results section but again I thought that was a default var.
does anyone know or have a clue why ec2.results wouldn't be populated?
Random shots in the dark:
- Is 'ec2' as a variable name clashing with the module name in some way?
What if you do 'register: foo' instead?
- What *is* in 'foo', if you 'debug: var=foo' it? Is it everything you'd
expect to see *except* the 'results' element, or something totally different?
Actually, backing up a step: What do you expect to see in the results
element, and why? Is the information that you're looking for somewhere
else in the variable?
-Josh (jbs@care.com)
(apologies for the automatic corporate disclaimer that follows)
This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system.
Matt that makes sense. I did try ec2.instances but it is only add the first host not all three. I did do a debug on ec2 and ec2.instances and it is showing all 3 instances that I’m turning up. Any ideas on that. This is only happening on the add_hosts module. I have a wait for ssh to come up task and ec2.instances var are giving me an ok for all three.
I did try ec2.instances but it is only add the first host not all
three. I did do a debug on ec2 and ec2.instances and it is showing all
3 instances that I'm turning up. Any ideas on that. This is only
happening on the add_hosts module. I have a wait for ssh to come up
task and ec2.instances var are giving me an ok for all three.
I tried with this trivial playbook, and it worked fine: