updated vagrant

This commit is contained in:
Radu Ioan Fericean
2016-03-11 21:36:30 +02:00
parent 79fa62a1c8
commit add958cc71
3 changed files with 66 additions and 58 deletions

View File

@@ -1,37 +1,38 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "debian74_64"
config.vm.box_url = "https://s3-eu-west-1.amazonaws.com/ffuenf-vagrant-boxes/debian/debian-7.4.0-amd64_virtualbox.box"
config.vm.network :public_network
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "debian83_64"
config.vm.box_url = "https://s3.eu-central-1.amazonaws.com/ffuenf-vagrantboxes/debian/debian-8.3.0-amd64_virtualbox.box"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network :forwarded_port, guest: 80, host: 8080
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network :private_network, ip: "192.168.33.10"
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network :public_network
# If true, then any SSH connections made will enable agent forwarding.
# Default value: false
# config.ssh.forward_agent = true
config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
@@ -43,16 +44,24 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider :virtualbox do |vb|
# # Don't boot with headless mode
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Use VBoxManage to customize the VM. For example to change memory:
# vb.customize ["modifyvm", :id, "--memory", "1024"]
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you're using for more
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
config.vm.provision "ansible" do |ansible|
ansible.playbook = "cgrates_devel.yml"
#ansible.verbose = "vvvv"

View File

@@ -0,0 +1 @@
default

View File

@@ -1,76 +1,74 @@
---
- hosts: all
user: vagrant
sudo: yes
become: true
vars:
root_db_password: CGRateS.org
tasks:
- name: install dependency
apt: pkg={{ item }} state=latest
with_items:
- git
- bzr
- redis-server
- mysql-server
- python-pycurl
- python-mysqldb
- mercurial
- name: add cgrates user
user: name=cgrates comment=CGRateS home=/var/run/cgrates shell=/bin/false system=yes
- name: add freeswitch gpg key
command: gpg --keyserver pool.sks-keyservers.net --recv-key D76EDC7725E010CF
- name: add freeswitch apt key
shell: gpg -a --export D76EDC7725E010CF | sudo apt-key add -
apt_key: url=https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub state=present
- name: add freeswitch apt repo
apt_repository: repo='deb http://files.freeswitch.org/repo/deb/debian/ wheezy main' state=present
- name: install freeswitch
apt_repository: repo='deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main' state=present
- name: add mongo gpg key
apt_key: keyserver=keyserver.ubuntu.com id=EA312927 state=present
- name: add mongo apt repo
apt_repository: repo='deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.2 main' state=present
- name: install dependency
apt: pkg={{ item }} update_cache=yes state=latest
with_items:
- git
- bzr
- mercurial
- redis-server
- mysql-server
- postgresql-9.4
- mongodb-org
- freeswitch-meta-vanilla
- freeswitch-mod-json-cdr
- libyuv-dev
- name: update mysql root password for root account
mysql_user: name=root host=localhost password={{ root_db_password }}
mysql_user: name=cgrates host=localhost password={{ root_db_password }}
- name: copy .my.cnf
template: src=my.cnf dest=/root/.my.cnf mode=0600
- hosts: all
user: vagrant
- hosts: all
vars:
root_db_password: CGRateS.org
go_version: 1.3
go_version: 1.6
tasks:
- name: get golang
get_url: url=https://storage.googleapis.com/golang/go{{ go_version }}.linux-amd64.tar.gz dest=~/go{{ go_version }}.linux-amd64.tar.gz
- name: unpack go
command: chdir=~/ tar xvf go{{ go_version }}.linux-amd64.tar.gz
- name: delete golang archive
file: path=~/go{{ go_version }}.linux-amd64.tar.gz state=absent
unarchive: src=https://storage.googleapis.com/golang/go{{ go_version }}.linux-amd64.tar.gz dest=~/go creates=~/go copy=no
- name: add variables to variables /etc/profile
copy: src=golang.sh dest=/etc/profile.d/golang.sh
sudo: yes
become: yes
- name: get cgrates
shell: GOROOT=~/go GOPATH=~/code ~/go/bin/go get -u -v github.com/cgrates/cgrates
git: repo=https://github.com/cgrates/cgrates.git dest=/home/vagrant/code/src/github.com/cgrates/cgrates
- name: get glide
shell: GOROOT=/home/vagrant/go GOPATH=/home/vagrant/code ~/go/bin/go get -u -v github.com/Masterminds/glide
- name: install cgrates
shell: cd /home/vagrant/code/src/github.com/cgrates/cgrates; ~/code/bin/glide install
- name: create cgr-engine link
file: src=/home/vagrant/code/bin/cgr-engine dest=/usr/bin/cgr-engine state=link
sudo: yes
become: yes
- name: create a link to data dir
sudo: yes
become: yes
file: src=/home/vagrant/code/src/github.com/cgrates/cgrates/data dest=/usr/share/cgrates state=link
- name: expand freeswitch json conf