This repository has been archived by the owner on Jan 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
local-openstack-swarm-blueprint.yaml
207 lines (189 loc) · 6.1 KB
/
local-openstack-swarm-blueprint.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
tosca_definitions_version: cloudify_dsl_1_3
imports:
- http://www.getcloudify.org/spec/cloudify/3.4/types.yaml
- http://www.getcloudify.org/spec/openstack-plugin/1.4/plugin.yaml
- http://www.getcloudify.org/spec/fabric-plugin/1.3.1/plugin.yaml
dsl_definitions:
os_config: &os_config
username: ''
password: ''
tenant_name: ''
auth_url: ''
inputs:
image:
description: image
flavor:
description: flavor
ssh_user:
description: ssh user
ssh_keyname:
description: ssh key name
ssh_keyfile:
description: ssh key file name
node_templates:
manager_host:
type: cloudify.openstack.nodes.Server
properties:
agent_config:
install_method: none
image: {get_input: image}
flavor: {get_input: flavor}
management_network_name: swarm_network
server:
resource_id: swarm_manager
openstack_config: *os_config
relationships:
- type: cloudify.openstack.server_connected_to_port
target: manager_port
- type: cloudify.openstack.server_connected_to_floating_ip
target: manager_public_ip
- type: cloudify.openstack.server_connected_to_keypair
target: keypair
worker_host:
type: cloudify.openstack.nodes.Server
properties:
agent_config:
install_method: none
image: {get_input: image}
flavor: {get_input: flavor}
management_network_name: swarm_network
server:
resource_id: swarm_manager
openstack_config: *os_config
relationships:
- type: cloudify.openstack.server_connected_to_port
target: worker_port
- type: cloudify.openstack.server_connected_to_floating_ip
target: worker_public_ip
- type: cloudify.openstack.server_connected_to_keypair
target: keypair
manager_public_ip:
type: cloudify.openstack.nodes.FloatingIP
properties:
openstack_config: *os_config
floatingip:
floating_network_name: external
worker_public_ip:
type: cloudify.openstack.nodes.FloatingIP
properties:
openstack_config: *os_config
floatingip:
floating_network_name: external
network:
type: cloudify.openstack.nodes.Network
properties:
resource_id: swarm_network
openstack_config: *os_config
network:
name: swarm_network
secgroup:
type: cloudify.openstack.nodes.SecurityGroup
properties:
resource_id: swarm_secgroup
openstack_config: *os_config
rules:
- port: 22
remote_ip_prefix: 0.0.0.0/0
- port: 80
remote_ip_prefix: 0.0.0.0/0
- remote_ip_prefix: 10.0.0.0/24
subnet:
type: cloudify.openstack.nodes.Subnet
properties:
resource_id: swarm_subnet
openstack_config: *os_config
subnet:
ip_version: 4
cidr: 10.0.0.0/24
gateway_ip: 10.0.0.1
dns_nameservers: [ "8.8.8.8" ]
relationships:
- type: cloudify.relationships.contained_in
target: network
- type: cloudify.openstack.subnet_connected_to_router
target: router
manager_port:
type: cloudify.openstack.nodes.Port
properties:
resource_id: manager_port
openstack_config: *os_config
relationships:
- type: cloudify.relationships.contained_in
target: network
- type: cloudify.relationships.depends_on
target: subnet
- type: cloudify.openstack.port_connected_to_security_group
target: secgroup
worker_port:
type: cloudify.openstack.nodes.Port
properties:
resource_id: worker_port
openstack_config: *os_config
relationships:
- type: cloudify.relationships.contained_in
target: network
- type: cloudify.relationships.depends_on
target: subnet
- type: cloudify.openstack.port_connected_to_security_group
target: secgroup
external_network:
type: cloudify.openstack.nodes.Network
properties:
openstack_config: *os_config
use_external_resource: true
resource_id: external
router:
type: cloudify.openstack.nodes.Router
properties:
resource_id: swarm_router
openstack_config: *os_config
relationships:
- target: external_network
type: cloudify.relationships.connected_to
keypair:
type: cloudify.openstack.nodes.KeyPair
properties:
openstack_config: *os_config
resource_id: {get_input: ssh_keyname}
use_external_resource: true
private_key_path: {get_input: ssh_keyfile}
manager:
type: cloudify.nodes.SoftwareComponent
interfaces:
cloudify.interfaces.lifecycle:
start:
implementation: fabric.fabric_plugin.tasks.run_script
inputs:
script_path: scripts/start-manager.sh
process:
env:
IP: {get_attribute: [manager_host, ip]}
fabric_env:
host_string: {get_attribute: [manager_public_ip, floating_ip_address]}
user: {get_input: ssh_user}
key_filename: {get_input: ssh_keyfile}
relationships:
- target: manager_host
type: cloudify.relationships.contained_in
worker:
type: cloudify.nodes.SoftwareComponent
interfaces:
cloudify.interfaces.lifecycle:
start:
implementation: fabric.fabric_plugin.tasks.run_script
inputs:
script_path: scripts/start-worker.sh
process:
env:
IP: {get_attribute: [worker_host, ip]}
MASTERIP: {get_attribute: [manager_host, ip]}
TOKEN: {get_attribute: [manager, worker_token]}
fabric_env:
host_string: {get_attribute: [worker_public_ip, floating_ip_address]}
user: {get_input: ssh_user}
key_filename: {get_input: ssh_keyfile}
relationships:
- target: worker_host
type: cloudify.relationships.contained_in
- target: manager
type: cloudify.relationships.connected_to