forked from chinmaya-dehury/webApp-loadbalancer-DB-TOSCA
-
Notifications
You must be signed in to change notification settings - Fork 1
/
service.yaml
185 lines (169 loc) · 5.48 KB
/
service.yaml
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
tosca_definitions_version: tosca_simple_yaml_1_3
node_types:
my.nodes.VM.OpenStack:
derived_from: tosca.nodes.Compute
properties:
name:
type: string
description: Name that should be given to the VM in OpenStack
image:
type: string
description: OpenStack image id (image names are not accepted)
flavor:
type: string
description: OpenStack flavor id (flavor names are not accepted)
network:
type: string
description: OpenStack network id (network names are not accepted)
key_name:
type: string
description: OpenStack SSH key name that should be placed on the VM
attributes:
id:
type: string
description: OpenStack id of the VM
interfaces:
Standard:
type: tosca.interfaces.node.lifecycle.Standard
operations:
create:
inputs:
vm_name: { default: { get_property: [ SELF, name ] } }
image: { default: { get_property: [ SELF, image ] } }
flavor: { default: { get_property: [ SELF, flavor ] } }
network: { default: { get_property: [ SELF, network ] } }
key_name: { default: { get_property: [ SELF, key_name ] } }
implementation: playbooks/vm/create.yml
delete:
inputs:
id: { default: { get_attribute: [ SELF, id ] } }
implementation: playbooks/vm/delete.yml
my.nodes.Nginx:
derived_from: tosca.nodes.SoftwareComponent
attributes:
site_config_dir:
type: string
description: Location of nginx site configs
remote_host_ip:
type: string
description: Location of nginx site configs
capabilities:
host:
type: tosca.capabilities.Compute
valid_source_types: [my.nodes.Nginx.Site]
interfaces:
Standard:
type: tosca.interfaces.node.lifecycle.Standard
operations:
create:
implementation:
primary: playbooks/nginx/install.yml
delete:
implementation:
primary: playbooks/nginx/uninstall.yml
my.nodes.Nginx.loadBalancer:
derived_from: tosca.nodes.SoftwareComponent
attributes:
site_config_dir:
type: string
description: Location of nginx site configs
remote_host_ip:
type: string
description: Location of nginx site configs
requirements:
- connectToLB:
capability: tosca.capabilities.Endpoint
node: my.nodes.Nginx.Site
relationship: radon.relationships.LB_WebApp
occurrences: [0, 1]
interfaces:
Standard:
type: tosca.interfaces.node.lifecycle.Standard
operations:
create:
implementation:
primary: playbooks/lb/install.yml
delete:
implementation:
primary: playbooks/lb/uninstall.yml
my.nodes.Nginx.Site:
derived_from: tosca.nodes.SoftwareComponent
properties:
hostname:
type: string
description: IP of the remote database
requirements:
- host:
capability: tosca.capabilities.Compute
relationship: my.relationships.NginxSiteHosting
capabilities:
connectToLB:
type: tosca.capabilities.Endpoint
valid_source_types: [ my.nodes.Nginx.loadBalancer ]
occurrences: [0, UNBOUNDED]
interfaces:
Standard:
type: tosca.interfaces.node.lifecycle.Standard
operations:
create:
inputs:
hostname: { default: { get_property: [ SELF, hostname ] } }
implementation: playbooks/site/create.yml
delete: playbooks/site/delete.yml
relationship_types:
radon.relationships.LB_WebApp:
derived_from: tosca.relationships.ConnectsTo
description: Allow the new web App to be connected to a existing load balancer.
# valid_target_types: [ my.nodes.Nginx.loadBalancer ]
interfaces:
Configure:
operations:
post_configure_source:
inputs:
LB_end_point_IP: { default: { get_attribute: [SOURCE, host, public_address] } }
WebApp_end_points_IP: { default: { get_attribute: [TARGET, host, host, public_address] } }
implementation:
primary: playbooks/nginx/add_webApp.yml
my.relationships.NginxSiteHosting:
derived_from: tosca.relationships.HostedOn
# valid_target_types: [my.nodes.Nginx]
interfaces:
Standard:
type: tosca.interfaces.node.lifecycle.Standard
operations:
post_configure_source:
implementation:
primary: playbooks/nginx/reload.yml
topology_template:
node_templates:
vm_loadBalancer:
type: my.nodes.VM.OpenStack
properties:
name: nginx_LB
image: centos7
flavor: m1.xsmall
network: provider_64_net
key_name: macbook-chinmaya
nginx-lb:
type: my.nodes.Nginx.loadBalancer
requirements:
- host: vm_loadBalancer
- connectToLB: site
vm1:
type: my.nodes.VM.OpenStack
properties:
name: nginx_host1
image: centos7
flavor: m1.xsmall
network: provider_64_net
key_name: macbook-chinmaya
nginx:
type: my.nodes.Nginx
requirements:
- host: vm1
site:
type: my.nodes.Nginx.Site
properties:
hostname: site
requirements:
- host: nginx