-
Notifications
You must be signed in to change notification settings - Fork 15
/
Vagrantfile
126 lines (105 loc) · 4.67 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
116
117
118
119
120
121
122
123
124
125
126
# Plugin checker by DevNIX: https://github.com/DevNIX/Vagrant-dependency-manager
# vagrant-reload is required to reboot Windows machines and retain Vagrant connection
require File.dirname(__FILE__)+'./Vagrant/Plugin/dependency_manager'
check_plugins ['vagrant-reload']
# Variables
## Boxes
windows_box_name = 'adamrushuk/win2016-std-dev'
windows_box_version = '1809.1.0'
linux_box_name = 'bento/centos-7.6'
linux_box_version = '201907.24.0'
## Network
## NIC Adapter #2 (1st NIC is reserved for Vagrant comms)
net_prefix = '192.168.10'
ansible01_ip = "#{net_prefix}.10"
web01_ip = "#{net_prefix}.11"
web02_ip = "#{net_prefix}.12"
# Main configuration
Vagrant.configure('2') do |config|
# VirtualBox global box settings
config.vm.provider 'virtualbox' do |vb|
vb.linked_clone = true
vb.gui = true
vb.customize ['modifyvm', :id, '--clipboard', 'bidirectional']
vb.customize ['setextradata', 'global', 'GUI/SuppressMessages', 'all']
end
# Increase timeout in case VMs joining the domain take a while to boot
config.vm.boot_timeout = 1200
# Ansible Control VM
config.vm.define 'ansible01' do |subconfig|
# CPU and RAM
subconfig.vm.provider 'virtualbox' do |vb|
vb.cpus = '1'
vb.memory = '2048'
end
# Hostname and networking
subconfig.vm.hostname = 'ansible01'
subconfig.vm.box = linux_box_name
subconfig.vm.box_version = linux_box_version
subconfig.vm.network 'private_network', ip: ansible01_ip
subconfig.vm.network 'forwarded_port', guest: 22, host: 33510, auto_correct: true
# subconfig.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__auto: true
# Provisioning
subconfig.vm.provision 'shell', path: 'vagrant/scripts/install_common.sh'
# Install Ansible
subconfig.vm.provision 'shell', path: 'vagrant/scripts/install_ansible.sh'
# Install Docker
subconfig.vm.provision 'shell', path: 'vagrant/scripts/install_docker_ce.sh'
# Install Ansible AWX
subconfig.vm.provision 'shell', path: 'vagrant/scripts/install_ansible_awx.sh'
end
# Web01
config.vm.define 'web01' do |subconfig|
# CPU and RAM
subconfig.vm.provider 'virtualbox' do |vb|
vb.cpus = '2'
vb.memory = '2048'
end
# WinRM plaintext is required for the domain to build properly (These settings should NOT be used on production machines)
subconfig.vm.communicator = 'winrm'
subconfig.winrm.transport = :plaintext
subconfig.winrm.basic_auth_only = true
# Hostname and networking
subconfig.vm.hostname = 'web01'
subconfig.vm.box = windows_box_name
subconfig.vm.box_version = windows_box_version
subconfig.vm.network 'private_network', ip: web01_ip
subconfig.vm.network 'forwarded_port', guest: 3389, host: 33511, auto_correct: true
subconfig.vm.network 'forwarded_port', guest: 80, host: 33512, auto_correct: true
subconfig.vm.network 'forwarded_port', guest: 443, host: 33513, auto_correct: true
# Provisioning
# Reset Windows license
subconfig.vm.provision 'shell', inline: 'cscript slmgr.vbs /rearm //B //NOLOGO'
# Configure remoting for Ansible
subconfig.vm.provision 'shell', path: 'vagrant/scripts/ConfigureRemotingForAnsible.ps1'
# Reboot VM
subconfig.vm.provision :reload
end
# Web02
config.vm.define 'web02' do |subconfig|
# CPU and RAM
subconfig.vm.provider 'virtualbox' do |vb|
vb.cpus = '2'
vb.memory = '2048'
end
# WinRM plaintext is required for the domain to build properly (These settings should NOT be used on production machines)
subconfig.vm.communicator = 'winrm'
subconfig.winrm.transport = :plaintext
subconfig.winrm.basic_auth_only = true
# Hostname and networking
subconfig.vm.hostname = 'web02'
subconfig.vm.box = windows_box_name
subconfig.vm.box_version = windows_box_version
subconfig.vm.network 'private_network', ip: web02_ip
subconfig.vm.network 'forwarded_port', guest: 3389, host: 33514, auto_correct: true
subconfig.vm.network 'forwarded_port', guest: 80, host: 33515, auto_correct: true
subconfig.vm.network 'forwarded_port', guest: 443, host: 33516, auto_correct: true
# Provisioning
# Reset Windows license
subconfig.vm.provision 'shell', inline: 'cscript slmgr.vbs /rearm //B //NOLOGO'
# Configure remoting for Ansible
subconfig.vm.provision 'shell', path: 'vagrant/scripts/ConfigureRemotingForAnsible.ps1'
# Reboot VM
subconfig.vm.provision :reload
end
end