

Install Jenkins in a EC2 instance Ubuntu 18.04 using ansible playbook. The following repos will be used:
- https://github.com/geerlingguy/ansible-role-java.git
- https://github.com/geerlingguy/ansible-role-jenkins.git
The main focus for this project is to prepare the EC2 instance with the required software to deploy, for this purpose ansible will be use to install jenkins
This project goal is to do a small example how to use this technology:
- Create a new user
- Provide roles to the new user
- Install an EC2 instance
- Install ansible
- Install java and jenkins software using ansible playbook
- Create the user
- Create a policy with the permissions to create an EC2 isntance
- Configure the user in aws cli in your standalone environment
- Create a KeyPair (For this case I use “jb_aws_keypair.pem”)
a. Configure the user in your aws cli
b. Create an EC2 instance using the Wizard
c. Connect to the EC2 instance and clone this repository in the EC2 instance
chmod 400 jb_aws_keypair.pem
ssh -i "jb_aws_keypair.pem" ubuntu@ec2-56-23-79-154.us-west-2.compute.amazonaws.com
git clone https://github.com/JoseBerrocal/Ansible_testing_project_02.git
d. Install Ansible
cd Ansible_testing_project_02
sh install_ansible.sh
e. Run Ansible
cd jenkins_ansible
ansible-playbook -i Inventory main.yaml
d. Access the URL of the EC2 instance, the output can be the following
To improve the project it will be required to install ansible in a first EC2 instance to later install jenkins in a different EC2 instance

Leave a Reply