Skip to content
This repository was archived by the owner on Oct 25, 2018. It is now read-only.

Commit b10bfd6

Browse files
author
Giuseppe Morelli
committed
Merge branch 'release/1.1.0'
2 parents 8fee718 + 5129364 commit b10bfd6

File tree

5 files changed

+164
-124
lines changed

5 files changed

+164
-124
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
/.idea
21
/config/config.yaml
32
/.vagrant

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# GMdotnet - Vagrant Multi Machine Virtualbox
22

3+
## 1.1.0
4+
- [dev] add nfs share
5+
- [dev] add options for rsync folders
6+
- [imp] readme and instruction to use
7+
38
## 1.0.0
49
- [dev] stable version
510

README.md

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![stable version](https://img.shields.io/badge/stable%20version-1.0.0-green.svg?style=flat-square)](https://github.com/gmdotnet/vagrant-multi-machine-virtualbox/releases/tag/1.0.0)
1+
[![stable version](https://img.shields.io/badge/stable%20version-1.1.0-green.svg?style=flat-square)](https://github.com/gmdotnet/vagrant-multi-machine-virtualbox/releases/tag/1.1.0)
22
[![develop](https://img.shields.io/badge/beta%20version-branch%20develop-oran.svg?style=flat-square)](https://github.com/gmdotnet/vagrant-multi-machine-virtualbox/tree/develop)
33
[![license](https://img.shields.io/badge/license-OSL--3-blue.svg?style=flat-square)](https://github.com/gmdotnet/vagrant-multi-machine-virtualbox/blob/master/LICENSE.txt)
44
[![gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/GMdotnet/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link)
@@ -10,8 +10,9 @@ This is a Multi Machine system for vagrant with Virtualbox provider.
1010
## Features
1111
- vagrant multi machine: create multiple machine at the same time
1212
- YAML config file. No more Vagrantfile to edit!
13-
- choose your favourite box, or get pre-configured box (see BOXES.md)
13+
- choose your favourite box, or get pre-configured box (see [BOXES.md](BOXES.md))
1414
- vagrant provision with script or ansible (configurable via yaml)
15+
- share your folder with Virtualbox, NFS or Rsync system directly from yaml file
1516
- integration - vagrant plugin HostsUpdater: no more /etc/hosts file to edit!
1617

1718
## Requirements
@@ -29,15 +30,68 @@ See `BOXES.md` for software installed list.
2930
- giuseppemorelli/lamp-stack 1.0.3 (debian jessie 8.6)
3031

3132
## How to use
32-
- download https://github.com/gmdotnet/vagrant-multi-machine-virtualbox/archive/master.zip
33-
- unzip on your favorite work folder
33+
- download latest version [https://github.com/gmdotnet/vagrant-multi-machine-virtualbox/releases](https://github.com/gmdotnet/vagrant-multi-machine-virtualbox/releases)
34+
- extract on your favorite work folder
3435
- rename `config/config.yaml.sample` in `config/config.yaml`
3536
- change settings in `config/config.yaml`
36-
(if you need more information about sync folder and rsync folder just have a look here: https://www.vagrantup.com/docs/synced-folders/basic_usage.html)
3737
- run `vagrant up` on folder where is `Vagrantfile`
3838
- (optional) make your configuration on vagrant machine entering by run `vagrant ssh`
3939
- have fun and happy coding!
4040

41+
### Config file `config.yaml`
42+
43+
Tab indent: 4 spaces or tab
44+
45+
| Field | Type | Description | Note |
46+
| ----------------------------------- | ------------- | ------------------------------------------------------- | ----- |
47+
| host | group field | Each group of `host` create a machine in virtualbox | |
48+
| enable | boolean | Enable or not the machine | Disabled machine aren't managed by Vagrant file, so if you want to destroy it you have to make this flag with `yes` |
49+
| vagrantbox_name | string | Name for vagrant software | |
50+
| hostname | string | Hostname of the machine | |
51+
| | | | |
52+
| **box** | | | |
53+
| box > name | string | Name of the public vagrant box | Need to be publish in https://app.vagrantup.com/boxes/search |
54+
| box > version | version x.y.z | Vagrant box version | Leave empty if you want to get latest version |
55+
| box > check_update | boolean | Check for update of your box | |
56+
| | | | |
57+
| private_ip | ipv4 | Internal ipv4 of the machine | Don't use same subnet of your computer |
58+
| ram | int | Amout of ram to allocate | |
59+
| | | | |
60+
| **provision** | | | |
61+
| provision > ansible > enable | boolean | Enable Ansible provisioning | |
62+
| provision > ansible > playbook_path | string | Relative path from Vagrantfile of your Ansible Playbook | |
63+
| provision > script > enable | boolean | Enable script provisioning | |
64+
| provision > script > path | string | Relative path from Vagrantfile of your script | |
65+
| | | | |
66+
| **plugin** | | | |
67+
| plugin > hostsupdater > enable | boolean | Enable or not hostsupdater plugin | https://github.com/cogitatio/vagrant-hostsupdater |
68+
| plugin > hostsupdater > permanent | boolean | Your changes to /etc/hosts will be permanent | Only if you destroy the machine, entries in /etc/hosts will be removed |
69+
| plugin > hostsupdater > aliases | array | domain aliases for the same ip | Leave blank for no aliases |
70+
| | | | |
71+
| **share** | | | |
72+
| share > folder | group field | Group of shared folder via virtualbox system | https://www.vagrantup.com/docs/synced-folders/basic_usage.html |
73+
| share > folder > host_folder | string | Path of the folder on your machine | |
74+
| share > folder > vagrant_folder | string | Path of the folder inside vagrant machine | |
75+
| share > folder > owner | string | Change owner folder inside vagrant machine | Default: vagrant |
76+
| share > folder > group | string | Change owner folder inside vagrant machine | Default: vagrant |
77+
| | | | |
78+
| **rsync** | | | |
79+
| rsync > folder | group field | Group of sync folder via rsync | |
80+
| rsync > folder > host_folder | string | Path of the folder on your machine | |
81+
| rsync > folder > vagrant_folder | string | Path of the folder inside vagrant machine | |
82+
| rsync > folder > options | group field | Rsync parameters. One per line | https://www.vagrantup.com/docs/synced-folders/rsync.html |
83+
| rsync > folder > exclude | group field | Exclude folders from rsync | https://www.vagrantup.com/docs/synced-folders/rsync.html#rsync__exclude |
84+
| | | | |
85+
| **nfs** | | | |
86+
| nfs > folder | group field | Group of sync folder via nfs | https://www.vagrantup.com/docs/synced-folders/nfs.html |
87+
| nfs > folder > host_folder | string | Path of the folder on your machine | |
88+
| nfs > folder > vagrant_folder | string | Path of the folder inside vagrant machine | |
89+
| nfs > folder > options | group field | Nfs options. One per line | https://www.vagrantup.com/docs/synced-folders/nfs.html#nfs-synced-folder-options |
90+
91+
## Find out GMdotnet Vagrant projects
92+
- Vagrant multi machine for **Amazon AWS**: [vagrant-multi-machine-amazon-aws](https://github.com/gmdotnet/vagrant-multi-machine-amazon-aws)
93+
- Vagrant multi machine for **Digital Ocean**: [vagrant-multi-machine-digital-ocean](https://github.com/gmdotnet/vagrant-multi-machine-digital-ocean)
94+
4195
## Contribution
4296
Any contribution is highly appreciated. The best way to contribute code is to open a [pull request on GitHub](https://help.github.com/articles/using-pull-requests).<br />Please create your pull request against the `develop` branch
4397

Vagrantfile

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
## ##
66
## GMdotnet ##
77
## Vagrant Multi Machine Virtualbox ##
8-
## Version 1.0.0 ##
8+
## Version 1.1.0 ##
99
## ##
1010
#######################################
1111

@@ -33,15 +33,15 @@ Vagrant.configure("2") do |config|
3333
vmhost.vm.box_check_update = host['box']['check_update']
3434

3535
# Hostsupdater plugin
36-
if host['plugin']['hostsupdater']['enable'] == true
36+
if host['plugins']['hostsupdater']['enable'] == true
3737

3838
# Hostsupdater aliases
39-
if host['plugin']['hostsupdater']['aliases'] != nil
40-
vmhost.hostsupdater.aliases = host['plugin']['hostsupdater']['aliases']
39+
if host['plugins']['hostsupdater']['aliases'] != nil
40+
vmhost.hostsupdater.aliases = host['plugins']['hostsupdater']['aliases']
4141
end
4242

4343
# Hostsupdater permanent role
44-
if host['plugin']['hostsupdater']['permanent'] == true
44+
if host['plugins']['hostsupdater']['permanent'] == true
4545
vmhost.hostsupdater.remove_on_suspend = false
4646
end
4747

@@ -65,7 +65,11 @@ Vagrant.configure("2") do |config|
6565
if share['folder']['group'] != nil
6666
group = share['folder']['group']
6767
end
68-
vmhost.vm.synced_folder share['folder']['host_folder'], share['folder']['vagrant_folder'], create: true, owner: owner, group: group
68+
vmhost.vm.synced_folder share['folder']['host_folder'],
69+
share['folder']['vagrant_folder'],
70+
create: true,
71+
owner: owner,
72+
group: group
6973
end
7074
end
7175
## -*- end shared folders -*-
@@ -74,14 +78,37 @@ Vagrant.configure("2") do |config|
7478
if host['rsync'] != nil
7579
host['rsync'].each do |rsync|
7680
rsyncoptions = []
81+
rsyncexclude = []
7782
rsync['folder']['options'].each do |options|
7883
rsyncoptions.push(options)
7984
end
80-
vmhost.vm.synced_folder rsync['folder']['host_folder'], rsync['folder']['vagrant_folder'], type: "rsync", rsync__args: rsyncoptions
85+
if rsync['folder']['exclude'] != nil
86+
rsync['folder']['exclude'].each do |options|
87+
rsyncexclude.push(options)
88+
end
89+
end
90+
vmhost.vm.synced_folder rsync['folder']['host_folder'], rsync['folder']['vagrant_folder'], type: "rsync",
91+
rsync__args: rsyncoptions,
92+
rsync__exclude: rsyncexclude
8193
end
8294
end
8395
## -*- end rsync folders -*-
8496

97+
# NFS folders
98+
if host['nfs'] != nil
99+
host['nfs'].each do |nfs|
100+
nfsoptions = []
101+
nfs['folder']['options'].each do |options|
102+
nfsoptions.push(options)
103+
end
104+
vmhost.vm.synced_folder nfs['folder']['host_folder'],
105+
nfs['folder']['vagrant_folder'],
106+
nfs: true,
107+
mount_options: nfsoptions
108+
end
109+
end
110+
## -*- end nfs folders -*-
111+
85112
# Virtualbox options
86113
vmhost.vm.provider "virtualbox" do |vb|
87114
# RAM

config/config.yaml.sample

Lines changed: 66 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -2,119 +2,74 @@
22
## ##
33
## GMdotnet ##
44
## Vagrant Multi Machine Virtualbox ##
5-
## Version 1.0.0 ##
5+
## Version 1.1.0 ##
66
## ##
77
## Config file ##
88
#######################################
99

1010
gmdotnet:
11-
- host:
12-
# enable or not the machine
13-
# if you not enable the machine, it will not be created
14-
enable: yes
15-
vagrantbox_name: gmweb
16-
hostname: gmweb
17-
box:
18-
name: giuseppemorelli/lamp-stack
19-
version: 1.0.2 # leave empty if you want the latest version
20-
check_update: yes
21-
private_ip: 192.168.250.10
22-
ram: 1024
23-
provision:
24-
ansible:
25-
enable: no
26-
playbook_path: "ansible/playbook.yml"
27-
script:
28-
enable: no
29-
path: "script/backup_database.sh"
30-
plugin:
31-
hostsupdater:
32-
enable: no # enable hostsupdater plugin
33-
permanent: no # your changes to /etc/hosts will be permanent
34-
aliases: ["alias.gmweb", "alias2.gmweb"] # alias for same ip in your file hosts, leave blank for no aliases
35-
# SHARED FOLDERS
36-
share:
37-
# - folder:
38-
# host_folder: /var/www/myproject.com
39-
# vagrant_folder: /var/www/myproject.com
40-
# owner: vagrant
41-
# group: vagrant
42-
# - folder:
43-
# host_folder: /mnt/archive
44-
# vagrant_folder: /mnt/archive
45-
# owner: vagrant
46-
# group: vagrant
47-
# RSYNC FOLDERS
48-
rsync:
49-
# - folder:
50-
# host_folder: /mnt/extra/rsync
51-
# vagrant_folder: /mnt/extra/rsync
52-
# options:
53-
# - "-a"
54-
# - "-r"
55-
# - "-v"
56-
# - "-z"
57-
# - "--delete"
58-
# - folder:
59-
# host_folder: /mnt/extra/rsync2
60-
# vagrant_folder: /mnt/extra/rsync2
61-
# options:
62-
# - "-a"
63-
# - "-r"
64-
# - "-v"
65-
# - "-z"
66-
- host:
67-
# enable or not the machine
68-
# if you not enable the machine, it will not be created
69-
enable: no
70-
vagrantbox_name: gmdb
71-
hostname: gmdb
72-
box:
73-
name: giuseppemorelli/lamp-stack
74-
version: 1.0.2 # leave empty if you want the latest version
75-
check_update: yes
76-
private_ip: 192.168.250.11
77-
ram: 1024
78-
provision:
79-
ansible:
80-
enable: no
81-
playbook_path: "ansible/playbook.yml"
82-
script:
83-
enable: no
84-
path: "script/backup_database.sh"
85-
plugin:
86-
hostsupdater:
87-
enable: no # enable hostsupdater plugin
88-
permanent: no # your changes to /etc/hosts will be permanent
89-
aliases: ["alias.gmweb", "alias2.gmweb"] # alias for same ip in your file hosts, leave blank for no aliases
90-
# SHARED FOLDERS
91-
share:
92-
# - folder:
93-
# host_folder: /var/www/myproject.com
94-
# vagrant_folder: /var/www/myproject.com
95-
# owner: vagrant
96-
# group: vagrant
97-
# - folder:
98-
# host_folder: /mnt/archive
99-
# vagrant_folder: /mnt/archive
100-
# owner: vagrant
101-
# group: vagrant
102-
# RSYNC FOLDERS
103-
rsync:
104-
# - folder:
105-
# host_folder: /mnt/extra/rsync
106-
# vagrant_folder: /mnt/extra/rsync
107-
# options:
108-
# - "-a"
109-
# - "-r"
110-
# - "-v"
111-
# - "-z"
112-
# - "--delete"
113-
# - folder:
114-
# host_folder: /mnt/extra/rsync2
115-
# vagrant_folder: /mnt/extra/rsync2
116-
# options:
117-
# - "-a"
118-
# - "-r"
119-
# - "-v"
120-
# - "-z"
11+
- host:
12+
# MACHINE
13+
enable: yes
14+
vagrantbox_name: gmweb
15+
hostname: gmweb
16+
box:
17+
name: giuseppemorelli/lamp-stack
18+
version: 1.0.2
19+
check_update: yes
20+
private_ip: 192.168.250.10
21+
ram: 1024
22+
# PROVISION
23+
provision:
24+
ansible:
25+
enable: no
26+
playbook_path: "ansible/playbook.yml"
27+
script:
28+
enable: no
29+
path: "script/backup_database.sh"
30+
# PLUGINS
31+
plugins:
32+
hostsupdater:
33+
enable: no
34+
permanent: no
35+
aliases: ["alias.gmweb", "alias2.gmweb"]
36+
# SHARED FOLDERS
37+
share:
38+
# - folder:
39+
# host_folder: /home/user/project
40+
# vagrant_folder: /var/www/project
41+
# owner: vagrant
42+
# group: vagrant
43+
# - folder:
44+
# host_folder: /mnt/archive
45+
# vagrant_folder: /mnt/archive
46+
# owner: vagrant
47+
# group: vagrant
48+
# RSYNC FOLDERS
49+
rsync:
50+
# - folder:
51+
# host_folder: /mnt/mysync
52+
# vagrant_folder: /mnt/rsyncfolder
53+
# options:
54+
# - "-a"
55+
# - "-r"
56+
# - "-v"
57+
# - "-z"
58+
# - "--delete"
59+
# - folder:
60+
# host_folder: /mnt/extra/rsync2
61+
# vagrant_folder: /mnt/extra/rsync2
62+
# options:
63+
# - "-a"
64+
# - "-r"
65+
# - "-v"
66+
# - "-z"
67+
# exclude:
68+
# - "myfolder"
69+
# NFS FOLDERS
70+
nfs:
71+
# - folder:
72+
# host_folder: /var/www/myproject
73+
# vagrant_folder: /var/www/project_vagrant
74+
# options:
75+
# - ""

0 commit comments

Comments
 (0)