Commit fc807b40 authored by Georgios Ouzounis's avatar Georgios Ouzounis
Browse files

LAM-33 Created apache-hadoop role.

parent 86cddbcf
---
- hosts: all
user: root
roles:
- ../roles/apache-hadoop
../files/
\ No newline at end of file
---
- hosts: all
user: root
tasks:
- include: ../tasks/hadoop/install.yml tags=install
- include: ../tasks/hadoop/config.yml tags=config
- hosts: master
user: root
tasks:
- include: ../tasks/hadoop/hdfs_format.yml tags=format
- include: ../tasks/hadoop/start.yml tags=start
- include: ../tasks/hadoop/hdfs_dirs.yml tags=mkdir
../tasks/
\ No newline at end of file
---
- name: Include common tasks.
include: setup.yml
tags:
- setup
- name: Include tasks for master.
include: master.yml
when: "'master' in group_names"
tags:
- master-install
---
- name: Format Apache HDFS.
shell: "yes | {{ installation_path }}/hadoop/bin/hadoop namenode -format"
tags:
- format-hdfs
- name: Start Apache HDFS.
shell: "{{ installation_path }}/hadoop/sbin/start-dfs.sh"
tags:
- start-hdfs
- name: Start Apache Yarn.
shell: "{{ installation_path }}/hadoop/sbin/start-yarn.sh"
tags:
- start-yarn
- name: Create Apache HDFS user directory.
command: "{{ installation_path }}/hadoop/bin/hadoop fs -mkdir /user"
tags:
- create-dirs
- name: Create Apache HDFS user/root directory.
command: "{{ installation_path }}/hadoop/bin/hadoop fs -mkdir /user/root"
tags:
- 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/hadoop-env.sh" 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 @@
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/usr/local/hadoop/tmp</value>
<value>{{ installation_path }}/hadoop/tmp</value>
</property>
</configuration>
......@@ -19,7 +19,7 @@
<configuration>
<property>
<name>dfs.replication</name>
<value>2</value>
<value>{{ dfs_replication }}</value>
</property>
<property>
<name>dfs.permissions</name>
......
---
mirror_url: "http://mirrors.myaegean.gr/apache/hadoop/common"
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/hadoop-env.sh 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
dest=/usr/local/hadoop/etc/hadoop/slaves
owner=root group=root mode=0644
tags: slaves
- name: Copy core configuration
template: src=../templates/usr/local/hadoop/etc/hadoop/core-site.xml.j2
dest=/usr/local/hadoop/etc/hadoop/core-site.xml
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
dest=/usr/local/hadoop/etc/hadoop/yarn-site.xml
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=http://mirrors.myaegean.gr/apache/hadoop/common/hadoop-2.7.0/hadoop-2.7.0.tar.gz
dest=/root/hadoop-2.7.0.tar.gz
- name: Untar hadoop
unarchive: src=/root/hadoop-2.7.0.tar.gz copy=no
dest=/usr/local/
- 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/start-dfs.sh
- name: Start yarn
command: /usr/local/hadoop/sbin/start-yarn.sh
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