forked from pmorillon/xp5k-openstack
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
109 lines (90 loc) · 2.45 KB
/
Rakefile
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
# Rakefile
# Rakefile for Openstack deployment on Grid5000
#
require 'xp5k'
require 'xp5k/rake' # Extend rake DSL to add role method and on method (ssh command // execution)
require 'hiera'
require 'ipaddr'
# Constants
#
SSH_CONFIGFILE_OPT = XP5K::Config[:ssh_config].nil? ? "" : " -F " + XP5K::Config[:ssh_config]
G5K_SUBNETS = {
rennes: { cidr: '10.156.0.0/14', gateway: '10.159.255.254' },
nantes: { cidr: '10.176.0.0/14', gateway: '10.179.255.254' },
lille: { cidr: '10.136.0.0/14', gateway: '10.139.255.254' },
reims: { cidr: '10.168.0.0/14', gateway: '10.171.255.254' },
nancy: { cidr: '10.144.0.0/14', gateway: '10.147.255.254' },
luxembourg: { cidr: '10.172.0.0/14', gateway: '10.175.255.254' },
lyon: { cidr: '10.140.0.0/14', gateway: '10.143.255.254' },
grenoble: { cidr: '10.132.0.0/14', gateway: '10.135.255.254' },
sophia: { cidr: '10.164.0.0/14', gateway: '10.167.255.254' },
}
# Load ./xp.conf file
#
XP5K::Config.load
# Initialize experiment
#
@xp = XP5K::XP.new()
def xp; @xp; end
# Defaults configuration
#
XP5K::Config[:scenario] ||= 'liberty_starter_kit'
XP5K::Config[:walltime] ||= '1:00:00'
XP5K::Config[:user] ||= ENV['USER']
XP5K::Config[:computes] ||= 1
XP5K::Config[:notification] ||= false
XP5K::Config[:jobname] ||= 'xp5k_openstack'
XP5K::Config[:puppet_release] ||= 4
XP5K::Config[:site] ||= 'rennes'
XP5K::Config[:openstack_env] ||= {
OS_USERNAME: 'admin',
OS_PASSWORD: 'admin',
OS_TENANT_NAME: 'openstack',
OS_AUTH_URL: 'http://127.0.0.1:5000/v2.0'
}
# Definitions
#
# Parse host environment var
def parse_host
args = ENV['host'].split(',')
hosts = []
args.each do |arg|
if XP5K::Role.listnames.include? arg
hosts << roles(arg)
else
hosts << arg
end
end
hosts.flatten
end
# Load Rake tasks
#
Dir["tasks/*.rb"].each do |taskfile|
load taskfile
end
# Load scenario dedicated Rake tasks
#
Dir["scenarios/#{XP5K::Config[:scenario]}/tasks/*.rb"].each do |taskfile|
load taskfile
end
# Meta task
#
desc 'Start Openstack deployment'
task :run do
workflow = [
'grid5000:jobs',
'grid5000:deploy',
'puppet:agent:install',
'puppet:hiera:generate',
'puppet:server:bootstrap',
'puppet:modules:get',
'puppet:modules:upload'
]
workflow.each do |task|
Rake::Task[task].execute
end
ENV['host'] = 'puppetserver'
Rake::Task['puppet:agent:run'].execute
Rake::Task['scenario:main'].execute
XP5K::Rake::Timer.summary
end