This Ansible Playbook helps setting up Hortonworks Hadoop Cluster with ease.
Deploying Hortonworks Data Platform (HDP) clusters typically required significant manual configuration using the Ambari GUI. Ansible provided a powerful way to automate server preparation and Ambari-based cluster deployment, enabling faster and more repeatable setups.
Ansible is a radically simple IT automation system. It handles configuration-management, application deployment, cloud provisioning, ad-hoc task-execution, and multinode orchestration - including trivializing things like zero downtime rolling updates with load balancers.
Read the documentation and more at https://ansible.com/
You can find installation instructions here for a variety of platforms. Most users should probably install a released version of Ansible from pip, a package manager or our release repository. Officially supported builds of Ansible are also available. Some power users run directly from the development branch - while significant efforts are made to ensure that devel is reasonably stable, you're more likely to encounter breaking changes when running Ansible this way.
ambari01
).
---
- name: Prepare nodes for Hortonworks HDP installation
hosts: all
become: yes
vars:
java_package: java-1.x.0-openjdk-devel
hdp_user: hadoop
tasks:
- name: Install required packages
yum:
name:
- ""
- wget
- ntp
- unzip
- curl
state: present
- name: Disable SELinux
selinux:
state: disabled
- name: Disable Firewall
service:
name: iptables
state: stopped
enabled: no
- name: Configure hostname
hostname:
name: ""
- name: Configure /etc/hosts
blockinfile:
path: /etc/hosts
block: |
192.168.1.10 ambari01
192.168.1.11 master01
192.168.1.12 worker01
192.168.1.13 worker02
- name: Start and enable NTP
service:
name: ntpd
state: started
enabled: yes
---
- name: Install Ambari Server on the management node
hosts: ambari
become: yes
tasks:
- name: Add Ambari repo
get_url:
url:
dest: /etc/yum.repos.d/ambari.repo
- name: Install Ambari server
yum:
name: ambari-server
state: present
- name: Setup Ambari server
command: ambari-server setup -s
- name: Start Ambari server
service:
name: ambari-server
state: started
enabled: yes
---
- name: Install Ambari Agent
hosts: all
become: yes
tasks:
- name: Add Ambari repo
get_url:
url:
dest: /etc/yum.repos.d/ambari.repo
- name: Install Ambari agent
yum:
name: ambari-agent
state: present
- name: Configure Ambari server hostname
lineinfile:
path: /etc/ambari-agent/conf/ambari-agent.ini
regexp: '^hostname=.*'
line: "hostname=ambari01"
- name: Start Ambari agent
service:
name: ambari-agent
state: started
enabled: yes
http://ambari01:8080
using admin/admin.
hortonworks-ansible/
├── inventory/
│ └── hosts.ini
├── playbooks/
│ ├── prepare-nodes.yml
│ ├── ambari-server-install.yml
│ └── ambari-agent-install.yml
└── group_vars/
└── all.yml
This Ansible-based setup helped simplify HDP cluster deployment by automating base image configuration and Ambari installation.