-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathfoobernetes_pp.pp
110 lines (101 loc) · 2.62 KB
/
foobernetes_pp.pp
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
workflow foobernetes_pp {
parameters => (
String $load_balancer_policy = lookup('foobernetes.policies.lb_policy')
),
returns => (
String $primary_load_balancer_id,
String $secondary_load_balancer_id,
String $from_action
)
} {
resource loadbalancer {
type => Foobernetes::Loadbalancer,
parameters => ($webserver1_id, $webserver2_id),
returns => ($primary_load_balancer_id = loadBalancerID)
}{
loadBalancerIP => '10.0.0.1',
location => 'eu1',
replica => false,
policy => $load_balancer_policy,
webServerIDs => [$webserver1_id, $webserver2_id],
tags => {
'team' => 'lyra team',
'role' => 'primary',
}
}
action foo {
parameters => ($database_id),
returns => ($from_action)
} {
notice("The created database has id: ", $database_id)
return(from_action => 'Message from foo action')
}
resource secondaryloadbalancer {
type => Foobernetes::Loadbalancer,
parameters => ($webserver1_id, $webserver2_id),
returns => ($secondary_load_balancer_id = loadBalancerID)
}{
loadBalancerIP => '10.0.0.2',
location => 'eu2',
replica => true,
policy => $load_balancer_policy,
webServerIDs => [$webserver1_id, $webserver2_id],
tags => {
'team' => 'lyra team',
'role' => 'secondary',
}
}
resource webserver1 {
type => Foobernetes::Webserver,
parameters => ($appserver1_id, $appserver2_id),
returns => ($webserver1_id = webServerID)
}{
port => 8080,
appServers => [$appserver1_id, $appserver2_id],
}
resource webserver2 {
type => Foobernetes::Webserver,
parameters => ($appserver1_id, $appserver2_id),
returns => ($webserver2_id = webServerID)
}{
port => 8080,
appServers => [$appserver1_id, $appserver2_id],
}
resource appserver1 {
type => Foobernetes::Instance,
parameters => ($database_id),
returns => ($appserver1_id = instanceID)
}{
location => 'eu1',
image => 'lyra::application',
config => {
'name' => 'appserver1xxx',
'databaseID' => $database_id
},
cpus => 4,
memory => '8G'
}
resource appserver2 {
type => Foobernetes::Instance,
parameters => ($database_id),
returns => ($appserver2_id = instanceID)
}{
location => 'eu2',
image => 'lyra::application',
config => {
'name' => 'appserver2xxx',
'databaseID' => $database_id
},
cpus => 16,
memory => '64G'
}
resource database {
type => Foobernetes::Instance,
returns => ($database_id = instanceID)
}{
location => 'eu1',
image => 'lyra::database',
cpus => 16,
memory => '64G'
}
}