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:
-
- hosts: localhost
code to create rds and register it with rds_database variable
debug tasks here say rds_database.instance.endpoint is exist
- hosts: localhost
code to create ec2 instance and add_hosts inside web group
-
- hosts: web
debug: msg=“{{ rds_database.instance.endpoint }}”
- hosts: web
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?