HDP Ansible Playbook Example

In my existing collection of automated install scripts for HDP I always try to extend it with further examples of different provisioners, providers, and settings. Recently I added with hdp22-n1-centos6-ansible an example Ansible environment for preparing a HDP 2.2 installation on one node.

Ansible differs from other provisioners like Puppet or Chef by a simplified approach in dependence on SSH. It behaves almost as a distributed shell putting little dependencies on existing hosts. Where for example Puppet makes strong assumptions about the current state of a system with one or multiple nodes, does Ansible more or less reflect a collection of tasks a system gone through to reach it’s current state. While some celebrate Ansible for it’s simplicity do others abandon it for it’s lack of strong integrity.

In this post I would like to share a sample Ansible Playbook to prepare a HDP 2.2 Amabri installation using Vagrant with Virtualbox. You can download and view the in this post discussed example here.

Installing HDP w/ Ansible

Every installation of HDP with Ambari is usually quite straight forward. First all possible interfering services like  iptables and  selinux are disabled or removed. Talking about an Ambari installation little but the installation of an Ambari agent on all nodes together with the installation of Amabri server on one node has to be accomplished. It is probably worth mentioning that for a cluster setup it is really important networking services like DNS have to work properly between all hosts.

To install HDP you obviously also need a repository containing the required service. Part of this can also be achieved by an installation through Ambari where as we only need the Ambari repo for 1.7 here.

Summary of installation tasks:

  1. Disable/Uninstall Interfering Services
  2. Configure Networking Services
  3. Install and Configure Ambari Repository
  4. Install and Configure Ambari Agent on ALL Nodes
  5. Install, Configure, and Start Ambari Server on ONE Node
  6. Install HDP using Ambari Blueprints

Ansbile Tasks to HDP 2.2

Disable/Uninstall Interfering Services

Possible interfering service are  iptables and selinux. Both are disabled with the following taks:

Configure Networking Services

Each hostname of the cluster needs to be resolve able by each host. We also need the Vagrant Host plugin, but some of this is also done with the following tasks. Also we need time synchronization using NTP:

Install and Configure Ambari Repository

We copy the Ambari repo using wget.  {{ hdp_ambari_repo }} is a variable passed to the playbook. In this case the variable is set in the Vagrant file:

Install and Configure Ambari Agent on ALL Nodes

On each node we install an Ambari agent and configure the possible Amabri server hostname:

Install, Configure, and Start Ambari Server on ONE Node

Only the “one” node installs the Amabri server. This is accomplished by the provided  ansible.group config in the Vagrant file:

Install HDP using Ambari Blueprints

As with all the given environments in the collection HDP is installed using Ambari blueprints. A default setting can be found in  blueprint.json and  hostmapping.json in the same folder as the Vagrant file. With  ./install_blueprint.sh this can be installed.

Putting It All Together

Ansible Playbook  hdp_centos6_playbook.yml:

Vagrant file:

Further Readings

  1. Automated Install with Amabri
  2. Ansible
  3. Puppet
  4. Chef
  5. Apache Ambari
  6. Vagrant Provisioning
  7. Pro Puppet: Second Edition (Amazon)
  8. Ansible: Up & Running (Amazon)

1 thought on “HDP Ansible Playbook Example”

Leave a Reply