Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit 27ea928

Browse files
authored
Merge pull request #10 from cloudify-examples/Add-GCP-Blueprint
Add gcp blueprint
2 parents ee4ec03 + 3b7cabc commit 27ea928

File tree

3 files changed

+287
-2
lines changed

3 files changed

+287
-2
lines changed

README.md

+36-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ _Note: Without bootstrap, deployment should take 5 minutes. With bootstrap, up t
55

66
To ask a question or report an issue, please use [github issues](https://github.com/cloudify-examples/cloudify-environment-setup/issues) or visit the [Cloudify users groups](https://groups.google.com/forum/#!forum/cloudify-users).
77

8+
*Alternative: Deploy your Cloudify Manager using an [IaaS Variant](https://github.com/cloudify-examples/environment-setup-variants).*
9+
810

911
# Purpose
1012

@@ -17,6 +19,7 @@ This blueprint sets up a reference environment for executing the Cloudify Exampl
1719
- [AWS Credentials](http://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html)
1820
- [Openstack Credentials](https://docs.openstack.org/user-guide/common/cli-set-environment-variables-using-openstack-rc.html) - *skip step 5 in those instructions -- do not "source" the file*.
1921
- [Azure Credentials](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-api-authentication)
22+
- [GCP Credentials](https://cloud.google.com/docs/authentication/getting-started)
2023
- A virtual environment application such as [virtualenv](https://virtualenv.pypa.io/en/stable/) installed on your computer.
2124
- [Cloudify CLI](http://docs.getcloudify.org/4.1.0/installation/from-packages/) installed in a virtual environment.
2225

@@ -74,6 +77,15 @@ When you execute the blueprint, you will provision the following resources in yo
7477
* cloudify_host_cloud_config
7578
* cloudify_host
7679

80+
* GCP Infrastructure
81+
* cfys0ip0 - Static External IP
82+
* cfynetwork
83+
* cfynetwork_subnet0
84+
* cfynetwork_subnet1
85+
* cfycloudify_security_group
86+
* cfycloudify_security_group1
87+
* controller_key
88+
* cfycloudify_host - Cloudify Manager VM
7789

7890
#### Secrets
7991

@@ -119,7 +131,23 @@ When you execute the blueprint, you will provision the following resources in yo
119131
* keystone_password: Your Keystone V2 password.
120132
* keystone_username:Your Keystone V2 username.
121133

122-
_Note: This command should be run from the same directory in which you extracted the blueprint in the previous step._
134+
135+
* GCP Secrets
136+
* client_x509_cert_url
137+
* client_email
138+
* client_id
139+
* project_id
140+
* private_key_id
141+
* private_key
142+
* management_network_name
143+
* zone
144+
* region
145+
* management_subnetwork_name
146+
* private_subnetwork_name
147+
* ubuntu_trusty_image
148+
* centos_core_image
149+
* small_instance_type
150+
123151

124152
## Preparation
125153

@@ -142,7 +170,7 @@ You will find a list of pre-bootstrapped images on [Cloudify's Downloads page](h
142170
Also, change the "bootstrap: True" to "False" in your inputs file.
143171
- Openstack: Follow [these instructions](https://docs.openstack.org/user-guide/dashboard-manage-images.html) to upload the [Openstack QCOW image](https://repository.cloudifysource.org/cloudify/4.1.1/ga-release/cloudify-enterprise-manager-4.1.1ga.qcow2) to Openstack.
144172
You will also need to find the correct values for cloudify_image, centos_core_image, ubuntu_trusty_image, small_image_flavor, large_image_flavor. Ask your Openstack Admin for more info on these.
145-
- Azure: There is not currently a pre-bootstrapped image for Azure, so bootstrap is the only option.
173+
- Azure & GCP: There is not currently a pre-bootstrapped image for Azure and GCP, so bootstrap is the only option.
146174

147175

148176

@@ -176,6 +204,12 @@ For Openstack run:
176204
$ cfy install cloudify-environment-setup-latest/openstack-blueprint.yaml -i cloudify-environment-setup-latest/inputs/openstack.yaml --install-plugins
177205
```
178206

207+
For GCP run:
208+
209+
```shell
210+
$ cfy install cloudify-environment-setup-latest/gcp-blueprint.yaml -i cloudify-environment-setup-latest/inputs/gcp.yaml --install-plugins
211+
```
212+
179213

180214
## Manager Setup Steps
181215

gcp-blueprint.yaml

+250
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
tosca_definitions_version: cloudify_dsl_1_3
2+
3+
imports:
4+
- https://raw.githubusercontent.com/cloudify-cosmo/cloudify-manager/4.1/resources/rest-service/cloudify/types/types.yaml
5+
- http://getcloudify.org.s3.amazonaws.com/spec/gcp-plugin/1.0/plugin.yaml
6+
- https://raw.githubusercontent.com/cloudify-incubator/cloudify-utilities-plugin/1.2.5/plugin.yaml
7+
- imports/manager-configuration.yaml
8+
9+
inputs:
10+
11+
client_x509_cert_url:
12+
type: string
13+
14+
client_email:
15+
type: string
16+
17+
client_id:
18+
type: string
19+
20+
project_id:
21+
type: string
22+
23+
private_key_id:
24+
type: string
25+
26+
private_key:
27+
type: string
28+
29+
zone:
30+
default: us-east1-b
31+
32+
region:
33+
default: us-east1
34+
35+
network_subnet0_cidr:
36+
default: 10.11.12.0/22
37+
38+
network_subnet1_cidr:
39+
default: 10.11.16.0/22
40+
41+
resource_prefix:
42+
default: cfy
43+
44+
cloudify_image_username:
45+
default: centos
46+
47+
local_ssh_directory:
48+
default: '~/.ssh/'
49+
50+
manager_key_name:
51+
default: cfy-manager-key
52+
53+
cloudify_key_file:
54+
default: { concat: [ { get_input: local_ssh_directory }, { get_input: manager_key_name } ] }
55+
56+
cloudify_image:
57+
default: https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-7-v20170523
58+
59+
centos_core_image:
60+
default: https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-7-v20170523
61+
62+
ubuntu_trusty_image:
63+
default: https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-1404-trusty-v20170517
64+
65+
small_instance_type:
66+
default: n1-standard-2
67+
68+
manager_ip:
69+
description: >
70+
Resolving the IP for manager setup.
71+
default: { get_attribute: [ network_subnet0_staticip, address ] }
72+
73+
secrets:
74+
description: >
75+
key, value pairs of secrets used in AWS blueprint examples.
76+
default:
77+
- key: client_x509_cert_url
78+
value: { get_input: client_x509_cert_url }
79+
- key: client_email
80+
value: { get_input: client_email }
81+
- key: client_id
82+
value: { get_input: client_id }
83+
- key: project_id
84+
value: { get_input: project_id }
85+
- key: private_key_id
86+
value: { get_input: private_key_id }
87+
- key: private_key
88+
value: { get_input: private_key }
89+
- key: management_network_name
90+
value: { get_property: [ network, name ] }
91+
- key: zone
92+
value: { get_input: zone }
93+
- key: region
94+
value: { get_input: region }
95+
- key: management_subnetwork_name
96+
value: { get_property: [ network_subnet0, name ] }
97+
- key: private_subnetwork_name
98+
value: { get_property: [ network_subnet1, name ] }
99+
- key: ubuntu_trusty_image
100+
value: { get_input: ubuntu_trusty_image }
101+
- key: centos_core_image
102+
value: { get_input: centos_core_image }
103+
- key: small_instance_type
104+
value: { get_input: small_instance_type }
105+
- key: agent_key_public
106+
value: { get_attribute: [ manager_key, public_key_export ] }
107+
- key: agent_key_private
108+
value: { get_attribute: [ manager_key, private_key_export ] }
109+
110+
create_inputs:
111+
default:
112+
local_private_key: { get_input: cloudify_key_file }
113+
rpm_package: { get_input: cli_package_url }
114+
public_ip: { get_input: manager_ip }
115+
private_ip: { get_attribute: [ cloudify_host, ip ] }
116+
ssh_user: { get_input: cloudify_image_username }
117+
ssh_key_filename:
118+
concat:
119+
- '/home/'
120+
- { get_input: cloudify_image_username }
121+
- '/.ssh/key.pem'
122+
123+
dsl_definitions:
124+
125+
client_config: &client_config
126+
auth:
127+
type: service_account
128+
auth_uri: https://accounts.google.com/o/oauth2/auth
129+
token_uri: https://accounts.google.com/o/oauth2/token
130+
auth_provider_x509_cert_url: https://www.googleapis.com/oauth2/v1/certs
131+
client_x509_cert_url: { get_input: client_x509_cert_url }
132+
client_email: { get_input: client_email }
133+
client_id: { get_input: client_id }
134+
project_id: { get_input: project_id }
135+
private_key_id: { get_input: private_key_id }
136+
private_key: { get_input: private_key }
137+
project: { get_input: project_id }
138+
zone: { get_input: zone }
139+
140+
node_templates:
141+
142+
manager_key:
143+
type: cloudify.keys.nodes.RSAKey
144+
properties:
145+
resource_config:
146+
public_key_path: { concat: [ { get_input: local_ssh_directory }, { get_input: manager_key_name }, '.pub' ] }
147+
private_key_path: { concat: [ { get_input: local_ssh_directory }, { get_input: manager_key_name } ] }
148+
openssh_format: true
149+
use_secret_store: false
150+
key_name: { get_input: manager_key_name }
151+
interfaces:
152+
cloudify.interfaces.lifecycle:
153+
create:
154+
implementation: keys.cloudify_ssh_key.operations.create
155+
inputs:
156+
store_private_key_material: true
157+
158+
network_subnet0_staticip:
159+
type: cloudify.gcp.nodes.Address
160+
properties:
161+
region: { get_input: region }
162+
gcp_config: *client_config
163+
name: { concat: [ { get_input: resource_prefix }, 's0ip0' ] }
164+
165+
network:
166+
type: cloudify.gcp.nodes.Network
167+
properties:
168+
gcp_config: *client_config
169+
name: { concat: [ { get_input: resource_prefix }, 'network' ] }
170+
auto_subnets: false
171+
172+
network_subnet0:
173+
type: cloudify.gcp.nodes.SubNetwork
174+
properties:
175+
gcp_config: *client_config
176+
name: { concat: [ { get_input: resource_prefix }, 'network_subnet0' ] }
177+
subnet: { get_input: network_subnet0_cidr }
178+
region: { get_input: region }
179+
relationships:
180+
- type: cloudify.gcp.relationships.contained_in_network
181+
target: network
182+
183+
network_subnet1:
184+
type: cloudify.gcp.nodes.SubNetwork
185+
properties:
186+
gcp_config: *client_config
187+
name: { concat: [ { get_input: resource_prefix }, 'network_subnet1' ] }
188+
subnet: { get_input: network_subnet1_cidr }
189+
region: { get_input: region }
190+
relationships:
191+
- type: cloudify.gcp.relationships.contained_in_network
192+
target: network
193+
194+
cloudify_security_group:
195+
type: cloudify.gcp.nodes.FirewallRule
196+
properties:
197+
gcp_config: *client_config
198+
name: { concat: [ { get_input: resource_prefix }, 'cloudify_security_group' ] }
199+
sources:
200+
- 0.0.0.0/0
201+
allowed:
202+
tcp: [22, 80, 443]
203+
icmp:
204+
relationships:
205+
- type: cloudify.relationships.connected_to
206+
target: network
207+
208+
cloudify_security_group1:
209+
type: cloudify.gcp.nodes.FirewallRule
210+
properties:
211+
gcp_config: *client_config
212+
name: { concat: [ { get_input: resource_prefix }, 'cloudify_security_group1' ] }
213+
sources:
214+
- { get_property: [ network_subnet0, subnet ] }
215+
- { get_property: [ network_subnet1, subnet ] }
216+
allowed:
217+
tcp: [5671, 8101, 53333, 8300, 8301, 8500, 22000, 15432]
218+
relationships:
219+
- type: cloudify.relationships.connected_to
220+
target: network
221+
222+
controller_key:
223+
type: cloudify.gcp.nodes.KeyPair
224+
properties:
225+
use_external_resource: true
226+
gcp_config: *client_config
227+
private_key_path: { get_property: [ manager_key, resource_config, private_key_path ] }
228+
public_key_path: { get_property: [ manager_key, resource_config, public_key_path ] }
229+
user: { get_input: cloudify_image_username }
230+
relationships:
231+
- type: cloudify.relationships.depends_on
232+
target: manager_key
233+
234+
cloudify_host:
235+
type: cloudify.gcp.nodes.Instance
236+
properties:
237+
name: { concat: [ { get_input: resource_prefix }, 'cloudify_host' ] }
238+
gcp_config: *client_config
239+
image_id: { get_input: cloudify_image }
240+
instance_type: { get_input: small_instance_type }
241+
zone: { get_input: zone }
242+
agent_config:
243+
install_method: none
244+
relationships:
245+
- type: cloudify.gcp.relationships.contained_in_network
246+
target: network_subnet0
247+
- type: cloudify.gcp.relationships.instance_connected_to_ip
248+
target: network_subnet0_staticip
249+
- type: cloudify.gcp.relationships.instance_connected_to_keypair
250+
target: controller_key

imports/manager-configuration.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ inputs:
4646
- https://github.com/cloudify-cosmo/cloudify-openstack-plugin/releases/download/2.2.0/cloudify_openstack_plugin-2.2.0-py27-none-linux_x86_64-centos-Core.wgn
4747
- http://repository.cloudifysource.org/cloudify/wagons/cloudify-azure-plugin/1.4.1/cloudify_azure_plugin-1.4.1-py27-none-linux_x86_64-centos-Core.wgn
4848
- https://github.com/cloudify-incubator/cloudify-azure-plugin/releases/download/1.4.3/cloudify_azure_plugin-1.4.3-py27-none-linux_x86_64.wgn
49+
- http://repository.cloudifysource.org/cloudify/wagons/cloudify-gcp-plugin/1.0/cloudify_gcp_plugin-1.0-py27-none-linux_x86_64-centos-Core.wgn
4950

5051
node_types:
5152

0 commit comments

Comments
 (0)