This repository has been archived by the owner on Jul 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Vagrantfile
55 lines (45 loc) · 1.56 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
require 'ipaddr'
hostname = "idp"
domain = "example.org"
fqdn_name = "#{hostname}.#{domain}"
ip_address = IPAddr.new('192.168.64.10')
machinesNames = Array["idp"]
machines = Hash.new
# Determine IP addresses to the VMs.
machinesNames.each { |machineName|
machines.store(machineName, ip_address.to_s)
ip_address = ip_address.succ
}
$python2 = <<SCRIPT
apt-get update
apt-get install -y python
SCRIPT
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.hostmanager.enabled = true
config.hostmanager.manage_host = false
config.hostmanager.manage_guest = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
config.vm.define "target" do |target|
target.vm.provider "virtualbox" do |vbox|
vbox.memory = 1024
vbox.name = "idp"
end
target.vm.network "private_network", ip: "#{machines["idp"]}"
target.vm.hostname = "#{fqdn_name}"
target.vm.provision "shell", inline: $python2
target.vm.provision "ansible" do |ansible|
ansible.playbook = "openconext-diy.yml"
ansible.groups = {
"idp" => ["target"],
"idp:vars" => {
"idp_hostname" => "#{fqdn_name}",
"idp_sp" => "https://sp.example.org",
"letsencrypt_email" => "idp@example.org",
"cert_subject" => "/C=US/ST=Nowhere/L=MyTown/O=IT/CN=#{fqdn_name}"
}
}
end
end
end