-
Notifications
You must be signed in to change notification settings - Fork 0
/
vagrantfile
71 lines (54 loc) · 2.15 KB
/
vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# create ubuntu node
config.vm.define "ubuntu-host" do |vm_config|
vm_config.vm.box = "geerlingguy/ubuntu1404"
vm_config.vm.hostname = "ubuntu-host"
# VirtualBox vm config
vm_config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
end
# (eth1) ansible network
vm_config.vm.network :private_network, ip: "10.0.10.11"
vm_config.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "~/.ssh/authorized_keys"
end
# create centos node
config.vm.define "centos-host" do |vm_config|
vm_config.vm.box = "geerlingguy/centos7"
vm_config.vm.hostname = "centos-host"
# VirtualBox vm config
vm_config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
end
# (eth1) ansible network
vm_config.vm.network :private_network, ip: "10.0.10.12"
vm_config.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "~/.ssh/authorized_keys"
end
# create deployment node
config.vm.define "deployer" do |vm_config|
vm_config.vm.box = "geerlingguy/centos7"
vm_config.vm.hostname = "deployer"
# VirtualBox VM config
vm_config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
end
# (eth1) ansible network
vm_config.vm.network :private_network, ip: "10.0.10.10"
vm_config.vm.provision "file", source: "~/.ssh/id_rsa", destination: "~/.ssh/id_rsa"
# bootstrap deployer (install packages, build ansible)
vm_config.vm.provision "shell", path: "bootstrap_ansible.sh"
# Patch for https://github.com/mitchellh/vagrant/issues/6793
vm_config.vm.provision "shell" do |s|
s.inline = '[[ ! -f $1 ]] || grep -F -q "$2" $1 || sed -i "/__main__/a \\ $2" $1'
s.args = ['/usr/bin/ansible-galaxy', "if sys.argv == ['/usr/bin/ansible-galaxy', '--help']: sys.argv.insert(1, 'info')"]
end
vm_config.vm.provision "ansible_local" do |ansible|
ansible.provisioning_path = "/opt/ansible-master"
ansible.playbook = "common.yml"
ansible.install = false
ansible.limit = "all"
ansible.inventory_path = "/vagrant/inventory"
end
end
end