-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathVagrantfile-Libvirt
108 lines (96 loc) · 2.48 KB
/
Vagrantfile-Libvirt
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# -*- mode: ruby -*-
# vi: set ft=ruby :
VM_NAME = "cloud.example.com"
IP1 = "192.168.20.10"
IP2 = "192.168.30.10"
Vagrant.configure(2) do |config|
config.vm.box = "centos71508"
config.vm.hostname = "#{VM_NAME}"
config.vm.define :rdo do |rdo|
rdo.vm.network :private_network, ip: "#{IP1}"
rdo.vm.network :private_network, ip: "#{IP2}"
rdo.vm.provider :libvirt do |domain|
domain.storage :file, :size => '10G', :type => 'raw'
#domain.storage :file, :size => '10G'
domain.memory = 8192
domain.cpus = 4
domain.cpu_mode = 'host-passthrough'
domain.nested = true
domain.volume_cache = 'none'
end
config.vm.provision "fix-no-tty", type: "shell" do |s|
s.privileged = false
s.inline = "sudo sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.bash_profile"
end
end
config.vm.provision "shell", inline: <<-SHELL
systemctl restart NetworkManager
cat <<CONF > /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
CONF
set -e
set -x
yum -y groupinstall "Development Tools"
yum -y install git wget
yum -y install python-devel libffi-devel openssl-devel libyaml-devel
yum update -y
rpm -ivh http://buildlogs.centos.org/centos/7/cloud/x86_64/openstack-kilo/centos-release-openstack-kilo-1-2.el7.noarch.rpm
cd /root
curl -O https://raw.githubusercontent.com/thaiopen/privatecloud/master/answerfile.txt
sleep 5
git clone https://github.com/openstack/packstack.git
sleep 5
cd packstack
python setup.py install
python setup.py install_puppet_modules
fdisk -u /dev/vdb <<EOF
n
p
1
t
8e
w
q
EOF
partprobe /dev/vdb1
pvcreate /dev/vdb1
vgcreate cinder-volumes /dev/vdb1
cd /root
packstack --answer-file answerfile.txt
cat <<BREX > /etc/sysconfig/network-scripts/ifcfg-br-ex
DEVICE="br-ex"
BOOTPROTO="static"
IPADDR="192.168.20.10"
PREFIX=24
DNS1="8.8.8.8"
GATEWAY="192.168.20.1"
NM_CONTROLLED="no"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="yes"
IPV6INIT=no
ONBOOT="yes"
TYPE="OVSIntPort"
OVS_BRIDGE=br-ex
DEVICETYPE="ovs"
BREX
IFACE=eth1
read MAC </sys/class/net/$IFACE/address
cat <<ETH1 > /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE="eth1"
ONBOOT="yes"
TYPE="OVSPort"
DEVICETYPE="ovs"
OVS_BRIDGE=br-ex
NM_CONTROLLED=no
IPV6INIT=no
HWADDR=$MAC
ETH1
chkconfig network on
service network restart
systemctl stop NetworkManager
systemctl disable NetworkManager
sed -i "32i ServerAlias 192.168.20.10" /etc/httpd/conf.d/15-horizon_vhost.conf
systemctl restart httpd
SHELL
end