On Apr 26, 2015 5:56 AM, Sergei Antipov <greenda...@gmail.com> 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 }}"
hostvars.localhost.rds_database
When using register it creates the variable for the host(s) in the play. Also, you need to make sure both plays are occurring within the same playbook run.
--
Jason DeTiberus
> 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 ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/120f9241-b879-4c38-8076-56c6f0b25587%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.