Vagrant/Ansible deployment for developers
authorWayne Schneider <wayne@indexdata.com>
Thu, 14 Jul 2016 20:21:16 +0000 (15:21 -0500)
committerWayne Schneider <wayne@indexdata.com>
Thu, 14 Jul 2016 20:21:16 +0000 (15:21 -0500)
.gitignore
Vagrantfile [new file with mode: 0644]
dev-deploy.yml [new file with mode: 0644]

index 8179ef5..966d6f0 100644 (file)
@@ -1,4 +1,6 @@
 *~
-deb-src/*
+deb-src/
 masterkey-lui-solr-*.tar.gz
 debian/changelog
+.vagrant/
+*.retry
diff --git a/Vagrantfile b/Vagrantfile
new file mode 100644 (file)
index 0000000..c53bd70
--- /dev/null
@@ -0,0 +1,14 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+Vagrant.configure(2) do |config|
+  # Target platform is Debian/jessie
+  config.vm.box = "debian/contrib-jessie64"
+
+  # Set up a forwarded port for testing
+  config.vm.network "forwarded_port", guest: 8983, host: 8983
+
+  config.vm.provision "ansible" do |ansible|
+    ansible.playbook = "dev-deploy.yml"
+  end
+end
diff --git a/dev-deploy.yml b/dev-deploy.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