Posts

Showing posts from January, 2021

Ansible Roles (Httpd + Haproxy)

Image
 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/

Ansible Playbook which will dynamically load the variable file named same as OS_name

Image
 Here, we will create 2 files RedHat.yml and Ubuntu.yml  Both will contain a variable called server and an ansible playbook will be created that will pick file accordingly the OS its been running and configure httpd if redhat and apache2 if it will be ubuntu. Here, os.yml is the main file that will pick other files depending on which it is been running This is the inventory file on which 137 is redhat and 135 is ubuntu Lets have a look at our playbook Files having server as a variable After running this file for ubuntu  For Redhat 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/

Dynamically pick the IP address of Docker container by Ansible

Image
 Today we will see how we can pick the dynamic IP of a docker container. First we will create a container by ansible and pull the centos image from docker hub. The complete playbook is  To run this playbook, use command ansible-playbook playbook_name After running it will prompt to ask the container name Lets see our docker service Now have a look at images Running containers We have to change the debug message to Output we get Lets check it by running inpect command of docker 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/