From 65f4bf82767c8cb126cd7fba089a69fa12b3ae8e Mon Sep 17 00:00:00 2001 From: Gracia Fernandez Date: Fri, 8 May 2015 16:23:02 +0100 Subject: [PATCH 1/7] Changed VM image to a basic Centos one. --- Vagrantfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 255c2ef..f1a7fda 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -10,7 +10,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # please see the online documentation at vagrantup.com. # Every Vagrant virtual environment requires a box to build off of. - config.vm.box = "puppetlabs/centos-6.5-64-nocm" + config.vm.box = "hansode/centos-6.5-x86_64" # Disable automatic box update checking. If you disable this, then # boxes will only be checked for updates when the user runs @@ -54,9 +54,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # VMs are up and running. slave2.vm.provision "ansible" do |ansible| ansible.inventory_path = "inventory/vagrant-virtualbox" - ansible.verbose = "v" + ansible.verbose = "vvv" # ansible.raw_arguments = "--check" - ansible.raw_arguments = "--private-key=~/.vagrant.d/insecure_private_key" +# ansible.raw_arguments = "--private-key=~/.vagrant.d/insecure_private_key" ansible.sudo = true ansible.playbook = "site.yml" ansible.extra_vars = { ansible_ssh_user: 'vagrant' } From 03baa18a112f2e112ec432428f22fc8e2d82cae9 Mon Sep 17 00:00:00 2001 From: Gracia Fernandez Date: Sun, 10 May 2015 16:35:13 +0100 Subject: [PATCH 2/7] Workaround to support ansible parallel provisioning in Vagrant 1.7+ --- Vagrantfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index f1a7fda..818702e 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -19,6 +19,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # config.vm.synced_folder "../data", "/vagrant_data" + # As of Vagrant 1.7+, the ansible parallel provisioning trick is easier to + # be implemented with `config.ssh.insert_key=false` (fallback to previous + # behaviour). + config.ssh.insert_key = false + config.vm.provider "virtualbox" do |v| v.customize ["modifyvm", :id, "--cpus", "1", "--memory", "1024"] end @@ -56,7 +61,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| ansible.inventory_path = "inventory/vagrant-virtualbox" ansible.verbose = "vvv" # ansible.raw_arguments = "--check" -# ansible.raw_arguments = "--private-key=~/.vagrant.d/insecure_private_key" + ansible.raw_arguments = "--private-key=~/.vagrant.d/insecure_private_key" ansible.sudo = true ansible.playbook = "site.yml" ansible.extra_vars = { ansible_ssh_user: 'vagrant' } From 4b58c33a416e350cab05a40c9ace17144327a777 Mon Sep 17 00:00:00 2001 From: Gracia Fernandez Date: Sun, 10 May 2015 19:48:04 +0100 Subject: [PATCH 3/7] Fixed error when trying to do yum update on CentOS 6.5 --- roles/geerlingguy.repo-epel/tasks/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/geerlingguy.repo-epel/tasks/main.yml b/roles/geerlingguy.repo-epel/tasks/main.yml index 8ac24a6..ad66e2e 100644 --- a/roles/geerlingguy.repo-epel/tasks/main.yml +++ b/roles/geerlingguy.repo-epel/tasks/main.yml @@ -1,4 +1,7 @@ --- +# Added to be able to update yum on centos 6.5 +- shell: echo "6" > /etc/yum/vars/releasever + - name: Install EPEL repo. yum: name: "{{ epel_repo_url }}" From c558e8c18ff9d75a656088af1bc30ca0bc93f463 Mon Sep 17 00:00:00 2001 From: Gracia Fernandez Date: Sun, 10 May 2015 20:12:51 +0100 Subject: [PATCH 4/7] Added ambari-repo role to all the hosts --- site.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/site.yml b/site.yml index a194fd0..b36dc78 100644 --- a/site.yml +++ b/site.yml @@ -16,6 +16,7 @@ sudo: yes roles: - common + - ambari-repo - name: Ambari server hosts: ambari From 9c8b728235b284bb91d9ed0d27d909161b5f3784 Mon Sep 17 00:00:00 2001 From: Gracia Fernandez Date: Sun, 10 May 2015 20:48:40 +0100 Subject: [PATCH 5/7] Added forwarded port in Vagrant to access the Ambari web interface. --- Vagrantfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index 818702e..7f40471 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -24,6 +24,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # behaviour). config.ssh.insert_key = false + # Create a forwarded port mapping which allows access to specific port + # within the machine from a port on the host machine. + config.vm.provider "virtualbox" do |v| v.customize ["modifyvm", :id, "--cpus", "1", "--memory", "1024"] end @@ -31,6 +34,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.define "ambari" do |ambari| ambari.vm.network "private_network", ip: "192.168.50.3" ambari.vm.hostname = "ambari.localdomain" + ambari.vm.network "forwarded_port", guest: 8080, host: 1234 end config.vm.define "master1" do |master1| From 797d9c6a97441926c1ca701f7231d125414efc3f Mon Sep 17 00:00:00 2001 From: Gracia Fernandez Date: Tue, 12 May 2015 15:44:16 +0100 Subject: [PATCH 6/7] Added fqdn to ansible inventory and added all the hosts to /etc/hosts. --- inventory/vagrant-virtualbox | 10 +++++----- roles/common/tasks/main.yml | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/inventory/vagrant-virtualbox b/inventory/vagrant-virtualbox index ccb8430..2d55915 100644 --- a/inventory/vagrant-virtualbox +++ b/inventory/vagrant-virtualbox @@ -1,22 +1,22 @@ # Ambari server will also run Ganglia and Nagios servers + ZK [ambari] -ambari ansible_ssh_host=192.168.50.3 +ambari.localdomain ansible_ssh_host=192.168.50.3 # Runs Namenode, Hive server will also run metastore and mysql server / webhcat / hcatalog, ZK [master1] -master1 ansible_ssh_host=192.168.50.4 +master1.localdomain ansible_ssh_host=192.168.50.4 # Runs resourcemanager, historyserver, ZK, secondary namenode [master2] -master2 ansible_ssh_host=192.168.50.5 +master2.localdomain ansible_ssh_host=192.168.50.5 [masters:children] master1 master2 [slaves] -slave1 ansible_ssh_host=192.168.50.6 -slave2 ansible_ssh_host=192.168.50.7 +slave1.localdomain ansible_ssh_host=192.168.50.6 +slave2.localdomain ansible_ssh_host=192.168.50.7 [all:children] ambari diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 66919a6..17fa0b8 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -31,6 +31,14 @@ - name: ensure iptables is stopped and is not running at boot time. service: name=iptables state=stopped enabled=no +# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source. +# Will include all hosts the playbook is run on. +# Credits to rothgar: https://gist.github.com/rothgar/8793800 + - name: Build hosts file (backups will be made) + lineinfile: dest=/etc/hosts regexp='{{ hostvars[item].ansible_hostname }}$' line='{{ hostvars[item]['ansible_ssh_host'] }} {{ item }} {{ hostvars[item].ansible_hostname }}' state=present backup=yes + when: hostvars[item].ansible_default_ipv4.address is defined + with_items: groups['all'] + #- name: ensure iptables6 is stopped and is not running at boot time. #service: name=iptables6 state=stopped enabled=no From 7d98568cc14803a6744d7b4ff0cc8348b9a63d6b Mon Sep 17 00:00:00 2001 From: Gracia Fernandez Date: Thu, 21 May 2015 15:15:10 +0100 Subject: [PATCH 7/7] Set VMs memory to the minimum required by the datanodes. --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 7f40471..93c7f6f 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -28,7 +28,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # within the machine from a port on the host machine. config.vm.provider "virtualbox" do |v| - v.customize ["modifyvm", :id, "--cpus", "1", "--memory", "1024"] + v.customize ["modifyvm", :id, "--cpus", "1", "--memory", "8192"] end config.vm.define "ambari" do |ambari|