This repository has been archived by the owner on Sep 11, 2019. It is now read-only.
forked from jctanner/gravity
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathVagrantfile
65 lines (55 loc) · 1.8 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
$script = <<SCRIPT
# AUTHENTICATION
echo 'root:vagrant' | chpasswd
echo 'vagrant:vagrant' | chpasswd
egrep "^PasswordAuthentication yes" /etc/ssh/sshd_config
RC=$?
if [[ $RC != 0 ]]; then
echo "Enabling ssh passwords"
sed -i.bak 's/PasswordAuthentication\ no/PasswordAuthentication\ yes/' /etc/ssh/sshd_config
service sshd restart
fi
# BASELINE PACKAGES
PACKAGES="epel-release ansible git vim-enhanced bind-utils policycoreutils-python"
for PKG in $PACKAGES; do
rpm -q $PKG || yum -y install $PKG
done
# VIMRC
rm -f /etc/vimrc
cp /vagrant/playbooks/files/centos7.vimrc /etc/vimrc
# PSEUDO ANSIBLE-LOCAL PROVISIONER
echo "gravity ansible_host=localhost ansible_connection=local" > /tmp/inv.ini
cd /vagrant/playbooks
ansible-playbook \
-v \
-i /tmp/inv.ini \
site.yml
# HACK IN FIREWALL EXCEPTIONS
systemctl enable firewalld
systemctl restart firewalld
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
setenforce 0
SCRIPT
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'libvirt'
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
#config.vm.box = "fedora/29-cloud-base"
config.vm.hostname = "gravity.eng.ansible.com"
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.manage_guest = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
config.vm.network "private_network", ip: "192.168.10.190"
#config.vm.synced_folder ".", "/vagrant", type: "nfs"
#config.vm.synced_folder ".", "/vagrant", type: "nfs", nfs_udp: true
config.vm.synced_folder ".", "/vagrant", type: "nfs", nfs_udp: false
config.vm.provision "shell", inline: $script
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 2
libvirt.memory = 2048
end
end