Skip to content
Snippets Groups Projects
Commit a5b8b801 authored by morbidick's avatar morbidick
Browse files

add dev vm with vagrant and ansible

parent 506ce422
Branches
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
## Startup ## Startup
meteor needs to be installed, no other dependencies meteor needs to be installed, no other dependencies
```` ````
vagrant up #optional
meteor --settings private/settings.json meteor --settings private/settings.json
```` ````
......
VAGRANTFILE_API_VERSION = "2" 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| 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: 3000, host: 3000, auto_correct: true
config.vm.network :forwarded_port, guest: 27017, host: 27017, auto_correct: true
config.ssh.forward_agent = 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| config.vm.provider "virtualbox" do |vb|
vb.memory = 1024 vb.memory = 1024
......
roles
*.retry
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
---
- 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"
---
- 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment