Summary: In this project I use Ansible to deploy a website on three different EC2 Instances at the same time using a playbook.
This picture shows the cloud architect layout.
_______________________________________________________________________________________________Below shows the 2 EC2 instances running along with the Ansible master machine.
After creating the ansible master ec2 instance, we need to ssh into it and run the ssh-keygen command to create keys that will be used to connect to the other instance we create.
I made a ssh key gen on the ansible master than we needed to import the public key into the ec2 console. So, with ansible target servers created, we will add the public key to them.
Here is the ansible inventory file listing all the ec2 target servers.
Here I used some ansible ad hoc commands to test the connection.
I created a playbook. The playbook YAML (ec2-play.yml) file is listen inside the repository, feel free to view. The ansible configuration file is also list above.
Here is the terminal output after running the playbook.
Note the public IPs for the two target severs. I will paste them in browser to check if the site is up and running on both servers.
Note: All servers were terminated for security reasons.