In this post, you will learn about ansible handlers. Handlers are like if and else in ansible, suppose you have a configuration file in httpd server, and you want whenever you change something in configuration file, the httpd service must restart. In this case we will use handlers. Components-: Controller node(192.168.1.7), Target node(192.168.1.8) The ansible-playbook looks like It will only run the handlers portion only when notify will be changed. Target Node- httpd is running on 8081. Playbook running when conf file is changed Playbook running second time You can view the webpage running on port 8081 Thank You for reading. I would like to thanks Vimal Daga Sir. ( https://www.linkedin.com/in/vimaldaga/ ) My Email — ayanchawlae@gmail.com My LinkedIn — https://www.linkedin.com/in/ayanchawlae/
Today we will create 2 ansible roles and then will run them combined to create a load balancer setup with 2 nodes connected to it. Lets first init the roles by ansibe galaxy After these commads t15.yml is the main file in which we have combined both the codes Lets create tasks in both the roles httpdserver -> tasks -> main.yml The main.yml file in httpdserver Similarly for loadbalancer role loadbalancer -> tasks -> main.yml The main.yml for loadbalancer The config file of haproxy looks like We can see the working of loadbalancer Thank You for reading. I would like to thanks Vimal Daga Sir. ( https://www.linkedin.com/in/vimaldaga/ ) My Email — ayanchawlae@gmail.com My LinkedIn — https://www.linkedin.com/in/ayanchawlae/
Here we will attach our Server folder with EBS volume. By chance if our EC2 instance crashed then all the data including our website will be lost. To prevent this we will attach that folder with an EBS volume in EC2 service. Note- Create and Attach an EBS volume with aws-cli To check the partitions use command fdisk -l Now enter into the hardisk and create partition, use command fdisk name Inside the hardisk type n and press enter (4times). After this type w to save the changes. Now format the partition created, use command mkfs.ext4 name At last mount your folder with formated partition, use command mount name /folder Now create a html file in it. Lets check our server working or not. Thank You for reading. I would like to thanks Vimal Daga Sir . ( https://www.linkedin.com/in/vimaldaga/ ) My Email — ayanchawlae@gmail.com My LinkedIn — https://www.linkedin.com/in/ayanchawlae/
Comments
Post a Comment