Commit fc807b40 authored by Georgios Ouzounis's avatar Georgios Ouzounis

LAM-33 Created apache-hadoop role.

parent 86cddbcf
- hosts: all
user: root
- ../roles/apache-hadoop
\ No newline at end of file
- hosts: all
user: root
- include: ../tasks/hadoop/install.yml tags=install
- include: ../tasks/hadoop/config.yml tags=config
- hosts: master
user: root
- include: ../tasks/hadoop/hdfs_format.yml tags=format
- include: ../tasks/hadoop/start.yml tags=start
- include: ../tasks/hadoop/hdfs_dirs.yml tags=mkdir
\ No newline at end of file
- name: Include common tasks.
include: setup.yml
- setup
- name: Include tasks for master.
include: master.yml
when: "'master' in group_names"
- master-install
- name: Format Apache HDFS.
shell: "yes | {{ installation_path }}/hadoop/bin/hadoop namenode -format"
- format-hdfs
- name: Start Apache HDFS.
shell: "{{ installation_path }}/hadoop/sbin/"
- start-hdfs
- name: Start Apache Yarn.
shell: "{{ installation_path }}/hadoop/sbin/"
- start-yarn
- name: Create Apache HDFS user directory.
command: "{{ installation_path }}/hadoop/bin/hadoop fs -mkdir /user"
- create-dirs
- name: Create Apache HDFS user/root directory.
command: "{{ installation_path }}/hadoop/bin/hadoop fs -mkdir /user/root"
- create-dirs
- name: Download Apache Hadoop.
get_url: url="{{ mirror_url }}/hadoop-{{ version }}/hadoop-{{ version }}.tar.gz" dest="{{ download_path }}/hadoop-{{ version }}.tar.gz"
- name: Uncompress Apache Hadoop.
unarchive: src="{{ download_path }}/hadoop-{{ version }}.tar.gz" dest="{{ installation_path }}" copy=no
- name: Create softlink for Apache Hadoop.
file: src="{{ installation_path }}/hadoop-{{ version }}" dest="{{ installation_path }}/hadoop" state=link
- name: Set JAVA_HOME in Apache Hadoop environment.
lineinfile: dest="{{ installation_path }}/hadoop/etc/hadoop/" regexp="^export JAVA_HOME=" line="export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64"
- name: Configure slaves.
template: src=slaves.j2 dest="{{ installation_path }}/hadoop/etc/hadoop/slaves" owner=root group=root mode=0644
- name: Configure core.
template: src=core-site.xml.j2 dest="{{ installation_path }}/hadoop/etc/hadoop/core-site.xml" owner=root group=root mode=0644
- name: Configure Apache HDFS.
template: src=hdfs-site.xml.j2 dest="{{ installation_path }}/hadoop/etc/hadoop/hdfs-site.xml" backup=no owner=root group=root mode=0644
- name: Configure Apache Yarn.
template: src=yarn-site.xml.j2 dest="{{ installation_path }}/hadoop/etc/hadoop/yarn-site.xml" owner=root group=root mode=0644
......@@ -23,6 +23,6 @@
<value>{{ installation_path }}/hadoop/tmp</value>
......@@ -19,7 +19,7 @@
<value>{{ dfs_replication }}</value>
mirror_url: ""
version: "2.7.0"
download_path: "/root"
installation_path: "/usr/local"
dfs_replication: 2
- name: Set hadoop env
lineinfile: dest=/usr/local/hadoop/etc/hadoop/ regexp="^export JAVA_HOME=" line="export JAVA_HOME=/usr/"
tags: env
- name: Copy slaves configuration
template: src=../templates/usr/local/hadoop/etc/hadoop/slaves.j2
owner=root group=root mode=0644
tags: slaves
- name: Copy core configuration
template: src=../templates/usr/local/hadoop/etc/hadoop/core-site.xml.j2
owner=root group=root mode=0644
tags: core
- name: Copy hdfs configuration
copy: src=../files/usr/local/hadoop/etc/hadoop/hdfs-site.xml
dest=/usr/local/hadoop/etc/hadoop/hdfs-site.xml backup=no
owner=root group=root mode=0644
tags: hdfs
- name: Copy yarn configuration
template: src=../templates/usr/local/hadoop/etc/hadoop/yarn-site.xml.j2
owner=root group=root mode=0644
tags: yarn
- name: Format hdfs
command: /usr/local/hadoop/bin/hadoop namenode -format -nonInteractive
- name: Download hadoop from apache servers
get_url: url=
- name: Untar hadoop
unarchive: src=/root/hadoop-2.7.0.tar.gz copy=no
- name: Make hadoop softlink
file: src=/usr/local/hadoop-2.7.0 dest=/usr/local/hadoop state=link
- name: Start hdfs
command: /usr/local/hadoop/sbin/
- name: Start yarn
command: /usr/local/hadoop/sbin/
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment