diff --git a/README.md b/README.md index 5525a2b60455a497126c22a6444ee3fdc1bb9d4b..35f9c15f791f3813a95b2f1c103073ae9044cf02 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ ## Startup meteor needs to be installed, no other dependencies ```` +vagrant up #optional meteor --settings private/settings.json ```` diff --git a/Vagrantfile b/Vagrantfile index 39bc2aa85e7ac758c17c0b640fa73c4a1679e519..d3f6f502442c7523bd99c924e7c82dade29d0ec1 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,51 +1,13 @@ VAGRANTFILE_API_VERSION = "2" -$setup = <<SCRIPT - -dependencies="htop vim git nodejs npm mongodb" - -function silent_install { - apt-get -y install "$@" >/dev/null 2>&1 -} - -echo updating package information -apt-get -y update >/dev/null 2>&1 - -echo installing dependencies -silent_install $dependencies - -if [ ! -f /usr/sbin/node ]; -then - echo creating node alias - ln -s /usr/bin/nodejs /usr/sbin/node -fi - - -if [ ! -f /usr/local/bin/meteor ]; -then - echo installing meteor - su vagrant - cd ~ - wget -q https://install.meteor.com/ -O meteor-install.sh - sh meteor-install.sh - - echo setting env to use installed mongodb - echo "export MONGO_URL=mongodb://localhost:27017/meteor" >> ~/.bashrc - - exit -fi - -echo done! -SCRIPT - - Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| - config.vm.box = "ubuntu/trusty64" + config.vm.box = "ubuntu/xenial64" config.vm.network :forwarded_port, guest: 3000, host: 3000, auto_correct: true + config.vm.network :forwarded_port, guest: 27017, host: 27017, auto_correct: true config.ssh.forward_agent = true - config.vm.provision :shell, inline: $setup + config.vm.provision :shell, path: "provisioning/init.sh", privileged: false config.vm.provider "virtualbox" do |vb| vb.memory = 1024 diff --git a/provisioning/.gitignore b/provisioning/.gitignore new file mode 100755 index 0000000000000000000000000000000000000000..00790cf52957084a09b494e7031bc950f1735afb --- /dev/null +++ b/provisioning/.gitignore @@ -0,0 +1,2 @@ +roles +*.retry diff --git a/provisioning/init.sh b/provisioning/init.sh new file mode 100755 index 0000000000000000000000000000000000000000..5c82d145dce37890150edbe777f2d5097bb1c307 --- /dev/null +++ b/provisioning/init.sh @@ -0,0 +1,12 @@ +echo "installing ansible" +sudo apt-add-repository ppa:ansible/ansible >/dev/null 2>&1 +sudo apt-get update >/dev/null 2>&1 +sudo apt-get install -y ansible git >/dev/null 2>&1 + +cd /vagrant/provisioning + +echo "get galaxy dependencies" +ansible-galaxy install -r requirements.yml -p roles --ignore-errors + +echo "executing ansible" +ansible-playbook -i "localhost," -c local playbook.yml diff --git a/provisioning/playbook.yml b/provisioning/playbook.yml new file mode 100755 index 0000000000000000000000000000000000000000..1a13c3f76a0f7db1cd5438192ce8612e0bd897f0 --- /dev/null +++ b/provisioning/playbook.yml @@ -0,0 +1,34 @@ +--- +- hosts: all + + roles: + - role: morbidick.common + become: yes + - role: geerlingguy.nodejs + become: yes + - role: carlosacp.meteor + become: no + + vars: + basic_packages: + - vim + - htop + - git + + addn_packages: + - mongodb + - make + - node-gyp + + meteor_version: "1.4.1.1" + + pre_tasks: + - name: fix meteor update server + lineinfile: + dest: /etc/hosts + line: "54.192.225.217 warehouse.meteor.com" + become: yes + - name: setting env to use installed mongodb + lineinfile: + dest: "{{ ansible_env.HOME }}/.bashrc" + line: "export MONGO_URL=mongodb://localhost:27017/meteor" diff --git a/provisioning/requirements.yml b/provisioning/requirements.yml new file mode 100755 index 0000000000000000000000000000000000000000..3cfe7df511acfb31b5229d91e38cec66d3a08db8 --- /dev/null +++ b/provisioning/requirements.yml @@ -0,0 +1,9 @@ +--- +- src: https://github.com/morbidick/ansible-role-common + name: morbidick.common + +- src: https://github.com/geerlingguy/ansible-role-nodejs + name: geerlingguy.nodejs + +- src: https://github.com/carlosacp/ansible-meteor + name: carlosacp.meteor