Posts

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/

Creating a Custom Network Topology

Image
 Today, we will create a topology such that there will be 3 systems  System A <-----------------> System B <-----------------> System C But System A and C can't connect. This can be done by assigning A and C different networks and B will have networks containing both networks of A and C.  The generation of packets depends upon the rules written in the routing table.  Lets assign Ip 192.168.1.1 to B with netmask of 255.255.0.0, It will conatain ips from 192.168.0.0 - 192.168.255.255 and System A will get ip 192.168.1.5 with netmask 255.255.255.252 and System C will get ip 192.168.2.5 with netmask 255.255.255.252. Both will contain only 4ips.  Ip can be set by commands  For B ifconfig enp0s3 192.168.1.1/16 For A ifconfig enp0s3 192.168.1.5/30 For C ifconfig enp0s3 192.168.2.5/30 Rules can be added by commands  For B route add -net 192.168.0.0/16 enp0s3 For A route add -net 192.168.1.0/30 enp0s3 For C route add -net 192.168.1.0/30 enp0s3 Lets ...

Setup to ping google but not Facebook from same system

Image
 Today we will create a setup so that we can ping to google but not facebook by using networking concepts and not a firewall. First, let's see our routing table by command  route -n Currently, we can ping to both google.com and facebook.com Here, -c refers to the number of counts of ping. Now, we will delete the rule that allows us to connect to the internet by command  route del -net 0.0.0.0 Now, we will add a new rule that only allow google to connect. Now, let's try to ping both again Facebook Failed Google Success   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/  

Use Ansible playbook to Configure Reverse Proxy

Image
 Today, We will configure reverse proxy server with ansible. In other words it is a system having load balancers and servers.  We have mainly 3 parts in this architecture  1. Controller Node 2. Load Balancers 3. Servers We will update our inventory file.  Here, Loadbalancer groups has all ips of load balancers and servers group has all servers ips. Lets have a look at our playbook.  After running this playbook. Our Servers are started Our Load Balancers config file.                                                                                                                                                ...

Ansible Handlers

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

Configure Hadoop and start cluster services using Ansible Playbook

Image
 Today, we will learn how to configure hadoop cluster using ansible. Setup: We need 3 machines - Ansible controller node(192.168.1.7), Hadoop Namenode(192.168.1.9), Hadoop Datanode(192.168.1.8) Steps: namenode install java  install hadoop create a directory  hdfs-site file config  <property> <name>dfs.data.dir</name> <value>/nn<value> </property> format directory with hadoop core-site file config <property> <name>fs.default.name</name> <value>hdfs://192.168.1.9:9001<value> </property> stop firewall start service slavenode install java  install hadoop create a directory hdfs-site file config <property> <name>dfs.data.dir</name> <value>/dn<value> </property> core-site file config <property> <name>fs.default.name</name> <value>hdfs://192.168.1.9:9001<value> </property> stop firewall start ser...