Commit c6852af6 authored by Themis Zamani's avatar Themis Zamani

Merge pull request #12 from efikalti/ansible

Ansible setup required packages 
parents eb3f971d ff730acb
# Package and variable setup
## VM package and variable setup
Contains Ansible playbook for the installation of required packages and variables. The play is split into five (3) tasks:
- install packages and run basic commands on newly created vms.
- fetch public ssh key from master.
- distribute public key to all slave nodes.
Currently, the playbooks are run from an external node, and deploy both master and slave nodes. In future version, they will run from the master node to deploy master and slave nodes.
### Things to do before deployment
- Install python
- Add the public key of the machine running the playbook to all the nodes.
### Prerequisites
- Deploy against Debian 8.0 node
- Make sure `python` is installed on the target nodes
- Ansible version used is `1.9.1`
### How to deploy
$ ansible-playbook -v playbooks/install.yml
# config file for ansible
remote_user = root
hostfile = hosts
export JAVA_HOME=/usr/
export HADOOP_HOME=/usr/local/hadoop
export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
export YARN_CONF_DIR=$HADOOP_HOME/etc/hadoop
export FLINK_HOME=/usr/local/flink
export KAFKA_HOME=/usr/local/kafka
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/hadoop/bin:/usr/local/hadoop/sbin:/usr/local/flink/bin" localhost snf-661306 snf-661303 snf-661304
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
- hosts: vms
user: root
# aptitude packages
- include: ../tasks/aptitude/upgrade.yml tags=install_scripts
- include: ../tasks/aptitude/java.yml tags=install_scripts
- include: ../tasks/aptitude/vim.yml tags=install_scripts
- include: ../tasks/aptitude/python.yml tags=install_scripts
# copy /etc/hosts file
- include: ../tasks/install/hosts.yml tags=install_scripts
# copy /etc/environment file
- include: ../tasks/install/environment.yml tags=install_scripts
# run ssh-keygen
- include: ../tasks/ssh/ssh-keygen.yml tags=install_scripts
- hosts: master
user: root
# copy ssh public key of master
- include: ../tasks/ssh/fetch-key.yml
- hosts: vms
user: root
# distribute ssh key to all nodes
- include: ../tasks/ssh/authorized-key.yml
# Install latest version of "openjdk-7-jdk" ignoring "install-recommends"
- name: install latest Java 7
tags: install_scripts
apt: name=openjdk-7-jdk state=latest install_recommends=no update_cache=yes
# Install python
- name: install python
tags: install_scripts
apt: name=python state=latest install_recommends=no update_cache=yes
# Update all packages to the latest version
- name: Upgrade packages
tags: install_scripts
apt: upgrade=dist update_cache=yes
# Install vim
- name: install vim
tags: install_scripts
apt: name=vim state=latest install_recommends=no update_cache=yes
#copy environment file
- name: Copy environment file
tags: install_scripts
copy: src=../files/etc/environment
dest=/etc/ backup=no
owner=root group=root mode=0750
#copy hosts ip-hostname file
- name: Copy hosts file
tags: install_scripts
copy: src=../files/etc/hosts
dest=/etc/ backup=no
owner=root group=root mode=0750
- name: ssh key
authorized_key: user=root key="{{ lookup('file', '/tmp/fetched/') }}"
- name: fetch file from master
fetch: src=/root/.ssh/ dest=/tmp/fetched/ flat=yes
- name: Run ssh-keygen
tags: install_scripts
shell: cat /dev/zero | ssh-keygen -q -N ""
creates: /root/.ssh/
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