|
| 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 |
0 commit comments