-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
115 lines (108 loc) · 5.5 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
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
109
110
111
112
113
114
115
# -*- mode: ruby -*-
# vi: set ft=ruby :
$clamav_script = <<SCRIPT
#Install clamav python3
apt-get update && apt-get -y install python3 python3-pip clamav
cd /tmp && git clone https://github.com/Hestat/lw-yara.git
clamscan -ir -l /vagrant/scanresults.txt -d /tmp/lw-yara/lw-rules_index.yar -d /tmp/lw-yara/lw.hdb /home
SCRIPT
Vagrant.configure("2") do |config|
config.vm.define "control01" do |webtier|
webtier.vm.box = "bento/ubuntu-19.04"
webtier.vm.hostname = "control01"
webtier.vm.network "private_network", ip: "192.168.45.10"
webtier.vm.provider "virtualbox" do |vb|
vb.name = "control01"
vb.gui = false
vb.memory = "512"
vb.cpus = 1
end
webtier.vm.provision "ansible_local" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.version = "2.9.4"
ansible.playbook = "deploy.yml"
end
webtier.vm.provision "shell", inline: <<-SHELL
hostnamectl set-hostname control01
echo "192.168.45.10 control01.local control01" |sudo tee -a /etc/hosts
echo "192.168.45.11 control02.local control02" |sudo tee -a /etc/hosts
echo "192.168.45.12 control03.local control03" |sudo tee -a /etc/hosts
echo "name: nameserver, ip: 8.8.8.8 " |sudo tee -a /etc/resolv.conf
webtier.vm.provision "shell", inline: $clamav_script, privileged: false
echo "===================================================================================="
hostnamectl status
echo "===================================================================================="
echo " \ ^__^ "
echo " \ (oo)\_______ "
echo " (__)\ )\/\ "
echo " ||----w | "
echo " || || "
SHELL
end
config.vm.define "control02" do |webtier|
webtier.vm.box = "bento/centos-7.7"
webtier.vm.hostname = "control02"
webtier.vm.network "private_network", ip: "192.168.45.11"
webtier.vm.provider "virtualbox" do |vb|
vb.name = "control02"
vb.gui = false
vb.memory = "512"
vb.cpus = 1
end
webtier.vm.provision "ansible_local" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.version = "2.9.2"
ansible.playbook = "deploy.yml"
end
webtier.vm.provision "shell", inline: <<-SHELL
hostnamectl set-hostname control02
echo "192.168.45.10 control01.local control01" |sudo tee -a /etc/hosts
echo "192.168.45.11 control02.local control02" |sudo tee -a /etc/hosts
echo "192.168.45.12 control03.local control03" |sudo tee -a /etc/hosts
echo "name: nameserver, ip: 8.8.8.8 " |sudo tee -a /etc/resolv.conf
SHELL
webtier.vm.provision "shell", inline: <<-SHELL
echo "===================================================================================="
hostnamectl status
echo "===================================================================================="
echo " \ ^__^ "
echo " \ (oo)\_______ "
echo " (__)\ )\/\ "
echo " ||----w | "
echo " || || "
SHELL
end
config.vm.define "control03" do |webtier|
webtier.vm.box = "bento/centos-7.7"
webtier.vm.hostname = "control03"
webtier.vm.network "private_network", ip: "192.168.45.12"
webtier.vm.provider "virtualbox" do |vb|
vb.name = "control03"
vb.gui = false
vb.memory = "1024"
vb.cpus = 1
end
webtier.vm.provision "shell", inline: <<-SHELL
hostnamectl set-hostname control03
echo "192.168.45.10 control01.local control01" |sudo tee -a /etc/hosts
echo "192.168.45.11 control02.local control02" |sudo tee -a /etc/hosts
echo "192.168.45.12 control03.local control03" |sudo tee -a /etc/hosts
echo "name: nameserver, ip: 8.8.8.8 " |sudo tee -a /etc/resolv.conf
SHELL
webtier.vm.provision "ansible_local" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.version = "2.9.2"
ansible.playbook = "deploy_RedHat.yml"
end
webtier.vm.provision "shell", inline: <<-SHELL
echo "===================================================================================="
hostnamectl status
echo "===================================================================================="
echo " \ ^__^ "
echo " \ (oo)\_______ "
echo " (__)\ )\/\ "
echo " ||----w | "
echo " || || "
SHELL
end
end