forked from ESGF/esgf-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
82 lines (76 loc) · 2.77 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'json'
# Vagrant configuration
Vagrant.configure(2) do |config|
config.vm.box = "cedadev/centos7"
# Use a fixed IP on the local network
config.vm.network :private_network, ip: "192.168.100.100"
# Set some virtualbox flags to improve time synchronisation between host and guest
config.vm.provider :virtualbox do |v|
# 512MB RAM is not really enough
v.memory = 4096
# sync time every 10 seconds
v.customize [ "guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-interval", 10000 ]
# adjustments if drift > 100 ms
v.customize [ "guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-min-adjust", 100 ]
# sync time on restore
v.customize [ "guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-on-restore", 1 ]
# sync time on start
v.customize [ "guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-start", 1 ]
# at 1 second drift, the time will be set and not "smoothly" adjusted
v.customize [ "guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 1000 ]
end
config.vm.provision :shell, inline: <<-SHELL
set -euo pipefail
echo "Installing roocs/mini-esgf-data into /test_data..."
curl -fsSL https://github.com/roocs/mini-esgf-data/tarball/master | tar -xz --strip-components=1 -C / */test_data
SHELL
# Provision the VM with our Ansible playbook
config.vm.provision :ansible do |ansible|
ansible.playbook = "deploy/ansible/playbook.yml"
# Configure the datasets from mini-esgf-data
# Use group_vars to simulate the advice in the documentation
# However, because the Ansible provisioner doesn't have a native group_vars
# property, like it does for {extra,host}_vars, we need to convert to JSON
data_mounts = [
{
host_path: "/test_data",
mount_path: "/test_data"
}
]
data_datasets = [
{
name: "CMIP5",
path: "esg_cmip5",
location: "/test_data/badc/cmip5/data"
},
{
name: "CORDEX",
path: "esg_cordex",
location: "/test_data/group_workspaces/jasmin2/cp4cds1/vol1/data/c3s-cordex"
}
]
solr_replicas = [
{
name: "llnl",
master_url: "https://esgf-node.llnl.gov/solr"
}
]
ansible.groups = {
"data" => ["default"],
"index" => ["default"],
"all:vars" => {
"hostname" => "192.168.100.100.nip.io",
"image_tag" => "future-architecture",
},
"data:vars" => {
"data_mounts" => "#{data_mounts.to_json}",
"data_datasets" => "#{data_datasets.to_json}"
},
"index:vars" => {
"solr_replicas" => "#{solr_replicas.to_json}"
}
}
end
end