Can I save a variable in one playbook, so it can be used by another one at a later time?
For example: playbook running cloudformation server provisioning task outputs some info that later needs to be used by playbook configuring software on those servers.
I guess I could just use lineinfile on a vars file to update a variable there, but may be there is a better way?
I’m working very intently on making a multi-az multi-tier h/a-minded multi-VPC CloudFormation framework, using cfndsl syntax, deployed strictly with Ansible playbooks. (or a custom module, if it comes to that)
Rather than using natively nested templates which require to be on S3 hosting, and due to the tiny limits placed on CloudFormation (10 output values, 51,200 bytes per template), I’m looking to execute (idempotently-possible) interlocking CloudFormation templates which pass outputs as parameters to other templates.
cfndsl provides the mechanism for doing for each loops to generate subnets, routes, route tables, etc. for each tier. At the end of this, I’ll be building a 10-tier 3-zone h/a VPC for application deployment plus a 2 or 3 tier, 3-zone h/a VPC for “universe” management (Ansible will live there).
The goal is to do something like OpsWorks with Ansible, but with cfndsl and multi-tier VPC’s in mind. For VPC’s an abstraction of “tier” is what I think most people would really like. OpsWorks uses “layers” for this, but they are just barely VPC aware.
My use case is the following:
I’m provisioning Redis server on EC2, after it’s done, I’m running ec2_facts module to get the private IP.
Later in the infrastructure provisioning I want to be able to use that IP.