Permalink
Fetching contributors…
Cannot retrieve contributors at this time
171 lines (149 sloc) 5.11 KB
---
###################################################
# Download/symlink oozie
###################################################
- block:
- name: install oozie required packages
apt:
name={{ item }}
state=latest
with_items:
- maven
- name: Configuring group
group:
name: "{{ oozie_group }}"
- name: Configuring user
user:
name: "{{ oozie_user }}"
group: "{{ oozie_group }}"
shell: /bin/bash
createhome: yes
- name: create installation directories
file:
path={{ item }}
state=directory
mode=0755
owner={{ oozie_user }}
group={{ oozie_group }}
with_items:
- "{{ oozie_install_dir }}"
- name: check for existing install
stat: path="{{ oozie_install_dir }}/oozie-{{ oozie_version }}"
register: oozie
- name: download oozie
get_url:
url: "{{ repository_infrastructure }}/oozie-{{ oozie_version }}.tar.gz"
dest: /tmp/oozie-{{ oozie_version }}.tgz
mode: 0644
validate_certs: no
when: oozie.stat.isdir is not defined
- name: extract oozie
unarchive:
src: /tmp/oozie-{{ oozie_version }}.tgz
dest: "{{ oozie_install_dir }}"
copy: no
owner: "{{ oozie_user }}"
group: "{{ oozie_group }}"
when: oozie.stat.isdir is not defined
- name: delete temporary oozie file
file:
path: /tmp/oozie-{{ oozie_version }}.tgz
state: absent
ignore_errors: yes
- name: create oozie symlink
file:
path: "{{ oozie_install_dir }}/default"
state: link
src: "{{ oozie_install_dir }}/oozie-{{ oozie_version }}"
tags: oozie-download
###################################################
# Configure/build oozie
###################################################
- block:
- name: check for original pom.xml file
stat:
path="{{ oozie_pom_xmlconfig }}.orig"
register: oozie_pom_orig
- name: backup default pom.xml file
command: cp "{{ oozie_pom_xmlconfig }}" "{{ oozie_pom_xmlconfig }}.orig"
when: not oozie_pom_orig.stat.exists
- name: populate pom.xml file
template:
src=pom.xml.j2
dest="{{ oozie_pom_xmlconfig }}"
owner="{{ oozie_user }}"
group="{{ oozie_user }}"
# - name: add oozie proxyuser to hadoop core-site.xml
# blockinfile:
# dest: "{{ oozie_external_vars.hdfs_conf_dir }}/core-site.xml"
# marker: "<!-- {mark} ANSIBLE MANAGED OOZIE BLOCK -->"
# insertbefore: "</configuration>"
# content: |
# <property>
# <name>hadoop.proxyuser.{{ oozie_external_vars.hdfs_user }}.hosts</name>
# <value>{{ inventory_hostname }}</value>
# </property>
# <property>
# <name>hadoop.proxyuser.{{ oozie_external_vars.hdfs_user }}.groups</name>
# <value>*</value>
# </property>
- name: create local hbase maven repo
command: >
mvn install:install-file
-Dfile="{{ oozie_external_vars.hbase_install_dir }}/hbase-{{ oozie_external_vars.hbase_version }}/lib/hbase-common-{{ oozie_external_vars.hbase_version }}.jar"
-DgroupId=org.apache.hbase
-DartifactId=hbase
-Dversion="{{ oozie_external_vars.hbase_version }}"
-Dpackaging=jar
- name: make oozie distro (long running)
command: bin/mkdistro.sh -DskipTests -Puber -Phadoop-2
args:
chdir: "{{ oozie_install_dir }}/default"
# oozie's resulting build directory is a bit silly
- name: create oozie distro symlink
file:
path={{ oozie_install_dir }}/default/oozie_build
src={{ oozie_install_dir }}/default/distro/target/oozie-{{ oozie_version }}-distro/oozie-{{ oozie_version }}
owner={{ oozie_user }}
group={{ oozie_group }}
state=link
- name: create libext directory
file:
path={{ oozie_install_dir }}/default/oozie_build/libext
state=directory
mode=0755
owner={{ oozie_user }}
group={{ oozie_group }}
- name: download extjs
get_url:
url: "{{ extjs_download_url }}"
dest: "{{ oozie_install_dir }}/default/oozie_build/libext"
- name: build oozie
command: bin/oozie-setup.sh prepare-war
args:
chdir: "{{ oozie_install_dir }}/default/oozie_build"
tags: oozie-build
###################################################
# Setup and run
###################################################
- block:
- name: initialize oozie db
command: bin/ooziedb.sh create -sqlfile oozie.sql
args:
chdir: "{{ oozie_install_dir }}/default/oozie_build"
- name: set oozie directory owner
file:
path={{ oozie_install_dir }}
owner={{ oozie_user }}
group={{ oozie_group }}
state=directory
recurse=yes
- name: copy oozie supervisord config
template:
src: oozie-supervisord.conf.j2
dest: "{{ supervisord_programs_dir }}/oozie-supervisord.conf"
mode: 0644
notify:
- reread supervisord
- restart oozie
tags: oozie-setup