Towards dev environment for HA
authorWayne Schneider <wayne@indexdata.com>
Wed, 27 Jul 2016 22:21:13 +0000 (17:21 -0500)
committerWayne Schneider <wayne@indexdata.com>
Wed, 27 Jul 2016 22:21:13 +0000 (17:21 -0500)
dev-deploy-ha/Vagrantfile [new file with mode: 0644]
dev-deploy-ha/dev-deploy-ha.yml [new file with mode: 0644]

diff --git a/dev-deploy-ha/Vagrantfile b/dev-deploy-ha/Vagrantfile
new file mode 100644 (file)
index 0000000..627cd5a
--- /dev/null
@@ -0,0 +1,41 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+Vagrant.configure(2) do |config|
+  # Define and configure SolrCloud cluster
+  cloudservers = {
+    "node1" => "192.168.2.4",
+    "node2" => "192.168.2.5",
+    "node3" => "192.168.2.6"
+  }
+
+  cloudservers.each do |server_name, server_ip|
+    config.vm.define server_name do |cloudconfig|
+      cloudconfig.vm.box = "debian/contrib-jessie64"
+      cloudconfig.vm.host_name = server_name.to_s
+      cloudconfig.vm.network "private_network", ip: server_ip
+    end
+  end
+
+  # Zookeeper node
+  config.vm.define "zookeeper" do |zookeeper|
+    zookeeper.vm.box = "debian/contrib-jessie64"
+    zookeeper.vm.host_name = "zookeeper"
+    zookeeper.vm.network "private_network", ip: "192.168.2.3"
+  end
+  
+  # Load balancer node
+  config.vm.define "loadbalancer" do |loadbalancer|
+    loadbalancer.vm.box = "debian/contrib-jessie64"
+    loadbalancer.vm.host_name = "loadbalancer"
+    loadbalancer.vm.network "private_network", ip: "192.168.2.2"
+  end
+    
+  # Disable the default shared folder, share out project folder as /vagrant for all boxes
+  config.vm.synced_folder ".", "/vagrant", disabled: true
+  config.vm.synced_folder "..", "/vagrant"
+
+  # config.vm.provision "ansible" do |ansible|
+  #   ansible.playbook = "dev-deploy.yml"
+  # end
+end
diff --git a/dev-deploy-ha/dev-deploy-ha.yml b/dev-deploy-ha/dev-deploy-ha.yml
new file mode 100644 (file)
index 0000000..7c07ddd
--- /dev/null
@@ -0,0 +1,55 @@
+---
+- hosts: default
+
+  vars:
+
+  tasks:
+    - name: Update apt-cache
+      become: yes
+      apt: update-cache=yes
+      
+    - name: Install dependencies from apt
+      become: yes
+      apt: name={{ item }} state=present
+      with_items:
+        - openjdk-7-jdk
+
+    - name: Create deployment environment
+      become: yes
+      file: path={{ item }} state=directory
+      with_items:
+        - /usr/share/masterkey/lui
+        - /var/lib/masterkey/lui/data/lui
+        - /var/log/masterkey/lui
+        - /etc/masterkey
+
+    - name: Create lui-solr account
+      become: yes
+      user: name=lui-solr state=present system=yes home=/var/lib/masterkey/lui
+
+    - name: Update permissions on deployment directories
+      become: yes
+      file: path={{ item }} owner=lui-solr recurse=yes
+      with_items:
+        - /var/lib/masterkey/lui
+        - /var/log/masterkey/lui
+
+    - name: Link Solr configuration
+      become: yes
+      file: src=/vagrant/conf path=/etc/masterkey/lui state=link
+
+    - name: Link Solr defaults
+      become: yes
+      file: src=/etc/masterkey/lui/lui-solr.in.sh path=/etc/default/lui-solr.in.sh state=link
+
+    - name: Install Solr binary
+      become: yes
+      command: /vagrant/dist/install_solr_service.sh /vagrant/dist/solr-5.5.1.tgz -d /var/lib/masterkey/lui -i /usr/share/masterkey/lui -s lui-solr -u lui-solr -f creates=/usr/share/masterkey/lui/solr-5.5.1
+
+    - name: Remove extra files created by Solr install
+      become: yes
+      file: path={{ item }} state=absent
+      with_items:
+        - /var/lib/masterkey/lui/log4j.properties
+        - /var/lib/masterkey/lui/logs
+        - /var/lib/masterkey/lui/data/solr.xml