--
You received this message because you are subscribed to the Google Groups "Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-deve...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
delegate_to means "run this command on this remote system" so it doesn't really make sense here.
What is sounds like what you want more of is the ability for the set_fact module to take a hostname in which to set the fact to.
I'd like to step back though, and ask where this 'some_var' is being used.If in a template, you can just include these lookups in the template, and it would be pretty straightforward, which also keeps your template more simplified.
I'd like to understand the end use case, as we step back away from Ansible concepts, and it will help me better suggest a way to model things.
I replied to this but my browser crashed as I submitted it. Did anyone get a copy so I don't have to re-write it?
For the time being I'll summarize that I think I'm in the same situation... this was the gist: https://gist.github.com/mark-casey/8364843. I'll re-write the commentary later if I have to.
Thanks,
Mark
I only meant the 'me too' with regards to the use case. I hadn't tried delegating set_fact (which i assume is what you were suggesting not doing, as opposed to not using ec2_facts for now). I just wondered if there was a better way to call ec2_facts after creating an instance and access them in a deployment role (in this case I need to use the private ec2 fqdn of a web server instance when setting some mysql permissions on a db instance).
The delegation discussion did make we wonder...could I just call ec2_facts right after instance creation but delegate the call to the instance itself instead of localhost? I think it would work within the role unless the facts were mistakenly set for localhost, but I don't know if the facts would bubble back up to the parent play; may try it Monday.
Alternatively (I can't remember...but...) if the ec2.py inventory returns facts that include the same ones ec2_facts provides, it might be easier to end the parent play after starting the instances and then recall ansible-playbook with a deployment playbook using dynamic inventory.
In truth my underlying issue is that with multiple public and private IPs and hostnames per ec2 instance, I don't know how to guarantee what I'll get out of the built-in ansible facts for names and IPs. Even with ec2_facts, if I ever have an instance with more than one public or private interface (though I've never needed to) I think I'll be in the same boat there.
Lastly, my continued thanks to you and your team for Ansible. Been working with it more lately and the more I learn the easier and better it is. :)
Thanks,