Facts for Create and Terminate Instances¶
Ansible provides additional EC2 information of
ec2 module using
which contains instance ids, image ids, regions, etc. Boot up plays creates ec2
instances for projects and applications are installed and datasets are loaded
to complete jobs on Cloud resources. If all jobs are finished successfully, the
last step would be terminating VM instances.
boot.yml playbook stores ec2
instance ids using
ec2_facts in YAML format and
uses the information to delete instances.
Sample ec2 facts are: .. include:: ec2_facts_for_vars.txt
boot.yml playbook stores instance information in a YAML file therefore
terminate.yml can find instance ids to terminate.
copy module (with content option) is used to store ec2_fact information in
a YAML file.
The nice thing about Ansible is that data variables in a YAML file can be
easily imported using
terminate.yml playbook uses it to
read the instance information that started by