From 736ca216d35802fb46b080c54d1c56becb3ca484 Mon Sep 17 00:00:00 2001 From: Wayne Schneider Date: Thu, 14 Jul 2016 15:21:16 -0500 Subject: [PATCH] Vagrant/Ansible deployment for developers --- .gitignore | 4 +++- Vagrantfile | 14 ++++++++++++++ dev-deploy.yml | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 Vagrantfile create mode 100644 dev-deploy.yml diff --git a/.gitignore b/.gitignore index 8179ef5..966d6f0 100644 --- a/.gitignore +++ b/.gitignore @@ -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 index 0000000..c53bd70 --- /dev/null +++ b/Vagrantfile @@ -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 index 0000000..7c07ddd --- /dev/null +++ b/dev-deploy.yml @@ -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 -- 1.7.10.4