Integrating Ansible with CloudFormation

While there are different strategies to integrate Ansible to CloudFormation, in our situation there is an obvious path to take. We are going to take advantage of the UserData field, and initialize Ansible through the ansible-pull command.

We are now going to start the Troposphere script that we created earlier in this chapter. We will duplicate this and call the new script as follows:

ansiblebase-cf-template.py. 

Go to your template repository and duplicate the previous template as follows:

$ cd EffectiveDevOpsTemplates 
$ cp helloworld-cf-template.py ansiblebase-cf-template.py 

Next, open the ansiblebase-cf-template.py script with your editor. To keep the script readable, we will first define several ...

Get Effective DevOps with AWS - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.