-
Notifications
You must be signed in to change notification settings - Fork 0
/
mongodb-openstack.yaml
279 lines (253 loc) · 8.88 KB
/
mongodb-openstack.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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
tosca_definitions_version: cloudify_dsl_1_3
imports:
- http://www.getcloudify.org/spec/cloudify/4.2/types.yaml
- http://www.getcloudify.org/spec/utilities-plugin/1.4.5/plugin.yaml
- http://www.getcloudify.org/spec/openstack-plugin/2.6.0/plugin.yaml
- mongodb/types/mongodbtypes.yaml
- mongodb/imports/mongodbV3.2-blueprint.yaml
inputs:
agent_key_private:
description: >
The content of the agent's private key.
default: { get_secret: agent_key_private }
agent_key_public:
description: >
The content of the agent's public key.
default: { get_secret: agent_key_public }
agent_user:
description: >
The username of the agent running on the instance created from the image.
default: ubuntu
image:
description: >
An Openstack Image ID. Tested with a Ubuntu 14.04 image.
type: string
default: { get_secret: ubuntu_trusty_image }
flavor:
description: >
An Openstack Flavor ID.
default: '2'
manager_network:
default: external
network_deployment_name:
default: openstack-example-network
dsl_definitions:
openstack_config: &openstack_config
username: { get_secret: keystone_username }
password: { get_secret: keystone_password }
tenant_name: { get_secret: keystone_tenant_name }
auth_url: { get_secret: keystone_url }
region: { get_secret: keystone_region }
compute_properties: &compute_properties
openstack_config: *openstack_config
agent_config:
network: { get_input: manager_network }
user: { get_input: agent_user }
install_method: init_script
port: 22
key: { get_input: agent_key_private }
server:
key_name: ''
image: { get_input: image }
flavor: { get_input: flavor }
management_network_name: ''
host_list: []
node_templates:
{% for host in ['mongod_host', 'mongos_host', 'mongo_config_host'] %}
{{host}}:
type: cloudify.openstack.nodes.Server
properties: *compute_properties
relationships:
- target: mongodb_host_port
type: cloudify.openstack.server_connected_to_port
interfaces:
cloudify.interfaces.lifecycle:
create:
implementation: openstack.nova_plugin.server.create
inputs:
args:
image: { get_input: image }
flavor: { get_input: flavor }
userdata: { get_attribute: [ cloudify_host_cloud_config, cloud_config ] }
{% endfor %}
# mongod_host:
# type: cloudify.openstack.nodes.Server
# properties: *compute_properties
# relationships:
# - target: mongodb_host_port
# type: cloudify.openstack.server_connected_to_port
# interfaces:
# cloudify.interfaces.lifecycle:
# create:
# implementation: openstack.nova_plugin.server.create
# inputs:
# args:
# image: { get_input: image }
# flavor: { get_input: flavor }
# userdata: { get_attribute: [ cloudify_host_cloud_config, cloud_config ] }
#
# mongos_host:
# type: cloudify.openstack.nodes.Server
# properties: *compute_properties
# relationships:
# - target: mongos_host_port
# type: cloudify.openstack.server_connected_to_port
# interfaces:
# cloudify.interfaces.lifecycle:
# create:
# implementation: openstack.nova_plugin.server.create
# inputs:
# args:
# image: { get_input: image }
# flavor: { get_input: flavor }
# userdata: { get_attribute: [ cloudify_host_cloud_config, cloud_config ] }
#
# mongo_config_host:
# type: cloudify.openstack.nodes.Server
# properties: *compute_properties
# relationships:
# - target: mongo_host_port
# type: cloudify.openstack.server_connected_to_port
# interfaces:
# cloudify.interfaces.lifecycle:
# create:
# implementation: openstack.nova_plugin.server.create
# inputs:
# args:
# image: { get_input: image }
# flavor: { get_input: flavor }
# userdata: { get_attribute: [ cloudify_host_cloud_config, cloud_config ] }
mongodb_host_port:
type: cloudify.openstack.nodes.Port
properties:
openstack_config: *openstack_config
relationships:
- type: cloudify.relationships.contained_in
target: public_network
- type: cloudify.relationships.depends_on
target: public_subnet
- type: cloudify.openstack.port_connected_to_security_group
target: security_group
- type: cloudify.openstack.port_connected_to_floating_ip
target: mongodb_host_ip
mongodb_host_ip:
type: cloudify.openstack.nodes.FloatingIP
properties:
openstack_config: *openstack_config
floatingip:
floating_network_id: { get_attribute: [ openstack, deployment, outputs, external_network ] }
relationships:
- type: cloudify.relationships.contained_in
target: openstack
mongos_host_port:
type: cloudify.openstack.nodes.Port
properties:
openstack_config: *openstack_config
relationships:
- type: cloudify.relationships.contained_in
target: public_network
- type: cloudify.relationships.depends_on
target: public_subnet
- type: cloudify.openstack.port_connected_to_security_group
target: security_group
- type: cloudify.openstack.port_connected_to_floating_ip
target: mongos_host_ip
mongos_host_ip:
type: cloudify.openstack.nodes.FloatingIP
properties:
openstack_config: *openstack_config
floatingip:
floating_network_id: { get_attribute: [ openstack, deployment, outputs, external_network ] }
relationships:
- type: cloudify.relationships.contained_in
target: openstack
mongo_host_port:
type: cloudify.openstack.nodes.Port
properties:
openstack_config: *openstack_config
relationships:
- type: cloudify.relationships.contained_in
target: public_network
- type: cloudify.relationships.depends_on
target: public_subnet
- type: cloudify.openstack.port_connected_to_security_group
target: security_group
- type: cloudify.openstack.port_connected_to_floating_ip
target: mongo_host_ip
mongo_host_ip:
type: cloudify.openstack.nodes.FloatingIP
properties:
openstack_config: *openstack_config
floatingip:
floating_network_id: { get_attribute: [ openstack, deployment, outputs, external_network ] }
relationships:
- type: cloudify.relationships.contained_in
target: openstack
public_subnet:
type: cloudify.openstack.nodes.Subnet
properties:
openstack_config: *openstack_config
use_external_resource: true
resource_id: { get_attribute: [ openstack, deployment, outputs, public_subnet ] }
relationships:
- type: cloudify.relationships.contained_in
target: public_network
public_network:
type: cloudify.openstack.nodes.Network
properties:
openstack_config: *openstack_config
use_external_resource: true
resource_id: { get_attribute: [ openstack, deployment, outputs, public_network ] }
relationships:
- type: cloudify.relationships.contained_in
target: openstack
security_group:
type: cloudify.openstack.nodes.SecurityGroup
properties:
openstack_config: *openstack_config
security_group:
description: generic security group
rules:
{% for host in ['mongod', 'mongos', 'mongo_config'] %}
- remote_ip_prefix: 0.0.0.0/0
port: { get_property: [ {{host}}, port] }
{% endfor %}
# - remote_ip_prefix: 0.0.0.0/0
# port: { get_property: [mongod, port] }
# - remote_ip_prefix: 0.0.0.0/0
# port: { get_property: [mongos, port] }
# - remote_ip_prefix: 0.0.0.0/0
# port: { get_property: [mongo_config, port] }
relationships:
- type: cloudify.relationships.contained_in
target: openstack
cloudify_host_cloud_config:
type: cloudify.nodes.CloudInit.CloudConfig
properties:
resource_config:
users:
- name: { get_input: agent_user }
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
ssh-authorized-keys:
- { get_input: agent_key_public }
openstack:
type: cloudify.nodes.DeploymentProxy
properties:
resource_config:
blueprint:
id: { get_input: network_deployment_name }
blueprint_archive: https://github.com/cloudify-examples/openstack-example-network/archive/master.zip
main_file_name: simple-blueprint.yaml
external_resource: external
deployment:
id: { get_input: network_deployment_name }
outputs:
external_network: external_network
public_network_router: public_network_router
public_network: public_network
private_network: private_network
public_subnet: public_subnet
private_subnet: private_subnet
external_resource: external
reexecute: false