Use Ansible's dynamic inventory and access the hostname like so:
"{{ hostvars[groups['rds_instance_name_goes_here][0]].ec2__address }}"
Make sure the instance is set to "publicly available" and the security 
group around it allows such connections.


On Sunday, 26 April 2015 11:56:22 UTC+2, Sergei Antipov wrote:
>
> Hello all.
> I can't find a solution for my problem.
>
> I need to create Amazon RDS instance and EC2 instance. And inside EC2 
> instance I need RDS public ip address.
> What I do:
>
> 1. - hosts: localhost
> code to create rds and register it with rds_database variable
> debug tasks here say rds_database.instance.endpoint is exist
>
> code to create ec2 instance and add_hosts inside web group
>
> 2. - hosts: web
> debug: msg="{{ rds_database.instance.endpoint }}"
> fatal: [xxx.xxx.xxx.xxx] => {'msg': "AnsibleUndefinedVariable: One or more 
> undefined variables: 'rds_database' is undefined", 'failed': True}
>
> I tried 
> - include: another.yml rds_database="{{ rds_database.instance.endpoint 
> }}", but this variable not evaluated before include.
>
> Should I use fact caching or I do something wrong?
>

-- 
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/b79e90d0-d216-45ae-a062-197757d48c75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to