-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocalstack-blueprint.yaml
162 lines (143 loc) · 4.87 KB
/
localstack-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
tosca_definitions_version: cloudify_dsl_1_3
imports:
- https://cloudify.co/spec/cloudify/6.1.0/types.yaml
- plugin:cloudify-openstack-plugin?version= >=3.0.0
inputs:
server_name:
type: string
default: server
server_image:
type: string
default: { get_secret: ubuntu_core_image }
server_flavor:
type: string
default: { get_secret: small_image_flavor }
user_domain_name:
default: default
project_domain_name:
default: default
key_pair_name:
default: { get_secret: key_pair_name }
external_nw_id:
default: { get_secret: external_network_id }
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
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_name: { get_secret: keystone_region }
user_domain_name: { get_input: user_domain_name }
project_domain_name: { get_input: project_domain_name }
node_templates:
### Using keypair in your OpenStack env
keypair:
type: cloudify.nodes.openstack.KeyPair
properties:
use_external_resource: true
resource_config:
name: { get_input: key_pair_name }
client_config: *openstack_config
### Allocate Floating IP from external network existing in you OpenStack env
virtual_ip:
type: cloudify.nodes.openstack.FloatingIP
properties:
client_config: *openstack_config
resource_config:
floating_network_id: { get_secret: external_network_id }
### Creates new Security group with required ports to be opened in order to ssh connect to localstack host and for interaction with localstack app
security_group:
type: cloudify.nodes.openstack.SecurityGroup
properties:
client_config: *openstack_config
resource_config:
name: security-group
description: 'security group'
security_group_rules:
- direction: ingress
protocol: tcp
port_range_min: 22
port_range_max: 22
- direction: ingress
protocol: tcp
port_range_min: 4566
port_range_max: 4566
- direction: ingress
protocol: tcp
port_range_min: 4571
port_range_max: 4571
### Create VM that will host localstack application
server_host:
type: cloudify.nodes.openstack.Server
properties:
resource_config:
name: { get_input: server_name }
client_config: *openstack_config
image: { get_input: server_image }
flavor: { get_input: server_flavor }
agent_config:
install_method: remote
user: { get_input: agent_user }
key: { get_input: agent_key_private }
relationships:
- target: host_port
type: cloudify.relationships.openstack.server_connected_to_port
- type: cloudify.relationships.openstack.server_connected_to_keypair
target: keypair
- type: cloudify.relationships.openstack.server_connected_to_floating_ip
target: virtual_ip
### Deploy and run localstack app
localstack_app:
type: cloudify.nodes.ApplicationModule
interfaces:
cloudify.interfaces.lifecycle:
create: scripts/create_localstack.sh
start: scripts/start_localstack.sh
relationships:
- type: cloudify.relationships.contained_in
target: server_host
host_port:
type: cloudify.nodes.openstack.Port
properties:
client_config: *openstack_config
relationships:
- type: cloudify.relationships.contained_in
target: private_network
- type: cloudify.relationships.depends_on
target: private_subnet
- type: cloudify.relationships.openstack.port_connected_to_security_group
target: security_group
### Will connect to an existing private network
private_subnet:
type: cloudify.nodes.openstack.Subnet
properties:
client_config: *openstack_config
use_external_resource: true
resource_config:
id: { get_secret: private_subnet_name }
relationships:
- type: cloudify.relationships.contained_in
target: private_network
private_network:
type: cloudify.nodes.openstack.Network
properties:
client_config: *openstack_config
use_external_resource: true
resource_config:
id: { get_secret: private_network_name }
capabilities:
url:
description: ip and port of the localstack application
value: { concat: [ 'http://', { get_attribute: [server_host, public_ip] }, ':', 4566 ] }