Configure Hadoop and start cluster services using Ansible Playbook

  1. Update your inventory
Add IP to be configured as master to namenode group and that to be configured as slave to datanode group

You can give any other group name but make changes in the playbook

Step 1: Install jdk

Step 2: Install hadoop

Step 3: Configure hdfs-site.xml file at /etc/hadoop/

Step 4: Configure core-site.xml file at /etc/hadoop/

Step 5: Format namenode

We only format the namenode

Use shell module to execute command to format namenode as command module doesn’t support ‘|’ operations

For more about command module read synopsis of command module

Step 6: Start services

You can find the code below:

After running playbook you can see the following:

Give directory name for namenode and the port number
Give directory name for datanode , port no and IP of namenode
You can see the services are running