Load Balancing HAProxy Setup On AWS Using Ansible ..!!

Created by Abhi

Pre-requisites :-

- hosts: localhost
— credential.yml
— name: Launching AWS Instance
key_name: keynew
instance_type: t2.micro
image: “ami-0ebc1ac48dfd14136”
wait: yes
count: 3
aws_access_key: “{{ ansibleuser }}”
aws_secret_key: “{{ ansipass }}”
vpc_subnet_id: subnet-82c7fdea
region: “ap-south-1”
group_id: “sg-9e0c4dfc”
assign_public_ip: yes
state: present
ansibleuser: AWS Access Key Here
ansipass: AWS Secret Key Here
ansible --version
vim /etc/ansible/ansible.cfg
vim /root/ansible_aws/hosts.txt
./ec2.py --list
ansible all -m ping
cd /lbserver
vim /task/main.ymlThis file will configure instance as load balancer
vim /handler/main.yml
vim /template/haproxy.cfg
cd /webserver
vim /task/main.ymlThis file will configure other instance as webserver
vim setup.yml
webserver :-server1
server 2
Loadbalancer :-



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abhishek Chouhan

Technology Enthusiast Like to learn new new tools and technology and integrate them, DevOps, Cloud, MLOps, Kubernetes, AWS, Terraform, Expertise in Docker…