Configuring Hadoop using ansible & How to use handlers and why to use?

Shubham kumar
2 min readJan 17, 2021

--

πŸ”° 11.1 Configure Hadoop and start cluster
services using Ansible Playbook

πŸ”° 11.2 Create an Article, blog, or Video on how
industries are solving challenges using Ansible.

πŸ”° 11.3 Restarting HTTPD Service is not
idempotence in nature and also consume more
resources suggest a way to rectify this challenge
in Ansible playbook

β€” β€” β€” β€” β€” β€” β€” 11.1 β€” β€” β€” β€” β€” β€” β€” β€”

Prerequisites: install Jdk and Hadoop-v1

Configure Hadoop and start cluster services using Ansible Playbook

configuring Hadoop hfds and core-site file as a name node or master

Checking on the ansible worker node that Hadoop is configured and started as namenode/master

β€” β€” β€” β€” β€” β€” β€” β€” 11.2 β€” β€” β€” β€” β€” β€” β€” β€” β€” β€”

link for 11.2 blog: click here

β€” β€” β€” β€” β€” β€” β€” β€” β€”11.3 β€” β€” β€” β€” β€” β€” β€” β€” β€”

Restarting httpd Service is not idempotence in nature and also consume more resources to suggest a way to rectify this challenge in the Ansible playbook
To overcome this problem we can use handlers in ansible i.e when there is a change in the HTTPD config file then only restart the HTTPD service.
EX:-
- name: Verify apache installation
hosts: webservers
vars:
http_port: 80
max_clients: 200
remote_user: root
tasks:
β€” name: Ensure apache is at the latest version
ansible.builtin.yum:
name: httpd
state: latest

β€” name: Write the apache config file
ansible.builtin.template:
src: /srv/httpd.j2
dest: /etc/httpd.conf
notify:
β€” Restart apache

β€” name: Ensure apache is running
ansible.builtin.service:
name: httpd
state: started

handlers:
β€” name: Restart apache
ansible.builtin.service:
name: httpd
state: restarted

#vimaldaga #righteducation #educationredefine
#rightmentor #worldrecordholder #linuxworld
#makingindiafutureready #righeudcation #arthbylw
#ansible ##facts #inventory #webserver

--

--

No responses yet