# AMI's, autoscaling, Fact Caching, registering results, modular playbooks, and continuous integration

**URL:** <https://forum.ansible.com/t/amis-autoscaling-fact-caching-registering-results-modular-playbooks-and-continuous-integration/16951>\
**Category:** Ansible Project\
**Created:** [December 3, 2014, 6:27pm UTC](https://forum.ansible.com/t/amis-autoscaling-fact-caching-registering-results-modular-playbooks-and-continuous-integration/16951 "2014-12-03T18:27:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robb\_Wagoner](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@Robb\_Wagoner](https://forum.ansible.com/u/Robb_Wagoner)\
**Post date:** [December 3, 2014, 6:27pm UTC](https://forum.ansible.com/t/amis-autoscaling-fact-caching-registering-results-modular-playbooks-and-continuous-integration/16951/1 "2014-12-03T18:27:32Z")

</div>

Hello all,

I have a rather complicated playbook which orchestrates the following plays: **(a)** input validation (extra-vars w/ asserts), **(b)** launching an EC2 instance, **(c)** configuring the instance, **(d)** fact gathering, **(e)** building and tagging an AMI from the instance, **(f)** using the AMI and the gathered facts to build Launch Configurations with user-data, **(g)** updating a couple of ASGs used for continuous integration (CI), and **(h)** terminating the instance launched at (b).

I am using Jenkins as the Ansible control host. The above playbook seems quite “heavy” and am wondering if there is a cleaner way to group the plays, into separate playbooks & Jenkins jobs. I’m most uncomfortable with **(g)** step being tied to the whole playbook, but I need to reference rather complicated Launch Configuration names (with Git SHA’s in them) from the previous step **(f)**.

Does Fact Caching works with Registered variables? I.e. if when I build the AMI and register the result in one Jenkins job, can I reference the registered variable in a later job? The facts would be for the Jenkins host (localhost).

Thanks,  
Robb

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [December 3, 2014, 6:50pm UTC](https://forum.ansible.com/t/amis-autoscaling-fact-caching-registering-results-modular-playbooks-and-continuous-integration/16951/2 "2014-12-03T18:50:28Z")

</div>

no, registered variables are not facts, you can use the template  
module to create a local fact in /etc/ansible/facts.d/ and trigger  
fact gathering again.

---

<div class="post-metadata">

**Author:** ![robb](https://avatars.discourse-cdn.com/v4/letter/r/a183cd/32.png) [@robb](https://forum.ansible.com/u/robb)\
**Post date:** [December 3, 2014, 7:26pm UTC](https://forum.ansible.com/t/amis-autoscaling-fact-caching-registering-results-modular-playbooks-and-continuous-integration/16951/3 "2014-12-03T19:26:17Z")

</div>

Very interesting approach/tip. Thanks Brian!
