Skip to content

Commit

Permalink
Merge pull request #342 from cloudify-community/new-file
Browse files Browse the repository at this point in the history
New file
  • Loading branch information
EarthmanT committed Oct 9, 2023
2 parents 564dd37 + 6e86363 commit 32fec4f
Show file tree
Hide file tree
Showing 27 changed files with 683 additions and 81 deletions.
16 changes: 16 additions & 0 deletions aws-example-network/blueprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ imports:
- https://cloudify.co/spec/cloudify/6.4.0/types.yaml
- plugin:cloudify-aws-plugin

labels:
csys-obj-type:
values:
- environment

inputs:

aws_access_key_id:
Expand Down Expand Up @@ -144,6 +149,9 @@ node_templates:
type: cloudify.nodes.aws.ec2.NATGateway
properties:
client_config: *client_config
resource_config:
kwargs:
ConnectivityType: public
relationships:
- type: cloudify.relationships.depends_on
target: public_subnet
Expand Down Expand Up @@ -184,6 +192,14 @@ capabilities:
description: 'aws region name'
value: { get_input: region_name }

vpc_cidr:
description: vpc_cidr
value: { get_input: vpc_cidr }

public_subnet_cidr:
description: public_subnet_cidr
value: { get_input: public_subnet_cidr }

ec2_region_endpoint:
description: 'ec2 region endpoint'
value: { get_input: ec2_region_endpoint }
Expand Down
67 changes: 43 additions & 24 deletions azure-example-network/blueprint.yaml
Original file line number Diff line number Diff line change
@@ -1,80 +1,99 @@
tosca_definitions_version: cloudify_dsl_1_4
tosca_definitions_version: cloudify_dsl_1_5

description: >
Create an Example Azure Network.
description: |
This blueprint creates a virtual network in Azure.
Azure Virtual Machines with public endpoints
can be installed on this virtual network
using the Cloudify "Deploy On" feature.
This is because of the label "csys-obj-type" value "environment".
Due to this label, Cloudify will know that the capabilities
can be used in conjunction with "deploy on".
imports:
- https://cloudify.co/spec/cloudify/6.4.0/types.yaml
- cloudify/types/types.yaml
- plugin:cloudify-azure-plugin

labels:

csys-obj-type:
values:
- environment

inputs:

env_name:
display_label: Env Name
type: string
default: 'cfy'

subscription_id:
subscription_id_name:
display_label: Name of Subscription Id
type: string
default: { get_secret: azure_subscription_id }
default: azure_subscription_id

tenant_id:
tenant_id_name:
display_label: Name of Tenant Id
type: string
default: { get_secret: azure_tenant_id }
default: azure_tenant_id

client_id:
client_id_name:
display_label: Name of Client Id
type: string
default: { get_secret: azure_client_id }
default: azure_client_id

client_secret:
client_secret_name:
display_label: Name of Client Secret
type: string
default: { get_secret: azure_client_secret }
default: azure_client_secret

endpoint_resource:
display_label: Endpoint Resource
type: string
default: https://management.core.windows.net/

endpoints_resource_manager:
display_label: Endpoints Resource Manager
type: string
default: https://management.azure.com

endpoint_verify:
display_label: Endpoint Verify
type: boolean
default: true

endpoint_storage:
type: string
default: core.windows.net

endpoints_active_directory:
display_label: Endpoints Active Directory
type: string
default: https://login.microsoftonline.com

location:
display_label: Location
type: string
description: Your Azure Region.
default: eastus2

retry_after:
display_label: Retry After
type: string
default: 5

resource_prefix:
display_label: Resource Prefix
type: string
default: { get_input: env_name }

resource_suffix:
display_label: Resource Suffix
type: string
default: 0

public_subnet_cidr:
display_label: Public Subnet Cidr
type: string
default: 10.10.2.0/24

private_subnet_cidr:
type: string
default: 10.10.3.0/24

network_api_version:
display_label: Network Api Version
type: string
description: >
API Version for Network
Expand All @@ -83,10 +102,10 @@ inputs:
dsl_definitions:

client_config: &client_config
subscription_id: { get_input: subscription_id }
tenant_id: { get_input: tenant_id }
client_id: { get_input: client_id }
client_secret: { get_input: client_secret }
subscription_id: { get_secret: { get_input: subscription_id_name } }
tenant_id: { get_secret: { get_input: tenant_id_name } }
client_id: { get_secret: { get_input: client_id_name } }
client_secret: { get_secret: { get_input: client_secret_name } }
endpoint_resource: { get_input: endpoint_resource }
endpoints_resource_manager: { get_input: endpoints_resource_manager }
endpoint_verify: { get_input: endpoint_verify }
Expand Down
171 changes: 171 additions & 0 deletions basic-agent/aws.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
tosca_definitions_version: cloudify_dsl_1_4

description: |
This blueprint creates a vm with an agent.
The requirements are as follows:
Your Cloudify manager should also be connected to the subnet (subnet_id).
Your Cloudify manager should also be governed by the security group (security_group_id).
Your security group should allow SSH between the vms in that security group.
Your security group should have 5671, 53333 ports open also to other vms on that security group.
There should be basic local routing for the subnet route table.
imports:
- http://cloudify.co/spec/cloudify/6.4.0/types.yaml
- plugin:cloudify-aws-plugin
- plugin:cloudify-utilities-plugin?version= >=1.22.1

inputs:

security_group_id:
type: string

subnet_id:
type: string

aws_region_name:
display_label: Aws Region Name
type: string
default: 'us-east-1'
constraints:
- valid_values:
- us-east-1
- us-east-2
- us-west-1
- us-west-2
- eu-central-1
- eu-west-1
- eu-west-2
- eu-south-1
- eu-west-3
- eu-north-1
- af-south-1
- ap-east-1
- ap-south-1
- ap-northeast-3
- ap-northeast-2
- ap-southeast-1
- ap-southeast-2
- ap-northeast-1
- ca-central-1
- cn-north-1
- cn-northwest-1
- me-south-1
- sa-east-1

instance_type:
type: string
default: t2.large
constraints:
- valid_values:
- t2.micro
- t2.small
- t2.medium
- t2.large
- t2.xlarge
- t2.2xlarge

agent_user:
type: string
description: >
The username of the agent running on the instance created from the image.
default: 'centos'

agent_key_name:
type: string
default: agent_key

dsl_definitions:

client_config: &client_config
aws_access_key_id: { get_secret: aws_access_key_id }
aws_secret_access_key: { get_secret: aws_secret_access_key }
region_name: { get_input: aws_region_name }

node_templates:

vm:
type: cloudify.nodes.aws.ec2.Instances
properties:
client_config: *client_config
agent_config:
install_method: remote
user: { get_input: agent_user }
key: { get_attribute: [agent_key, private_key_export] }
port: 22
resource_config:
ImageId: { get_attribute: [ ami, aws_resource_id ] }
InstanceType: { get_input: instance_type }
kwargs:
UserData: { get_attribute: [ cloud_init, cloud_config ] }
relationships:
- type: cloudify.relationships.depends_on
target: ami
- type: cloudify.relationships.depends_on
target: nic
- type: cloudify.relationships.depends_on
target: ip
- type: cloudify.relationships.depends_on
target: cloud_init

ami:
type: cloudify.nodes.aws.ec2.Image
properties:
resource_config:
kwargs:
Filters:
- Name: name
Values:
- 'CentOS7-cloudify-examples-image'
- Name: owner-id
Values:
- '263721492972'
client_config: *client_config

ip:
type: cloudify.nodes.aws.ec2.ElasticIP
properties:
client_config: *client_config
relationships:
- type: cloudify.relationships.depends_on
target: nic

nic:
type: cloudify.nodes.aws.ec2.Interface
properties:
client_config: *client_config
resource_config:
kwargs:
Description: Created by cloudify-getting-started-example.
SubnetId: { get_input: subnet_id }
Groups:
- { get_input: security_group_id }

cloud_init:
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_attribute: [agent_key, public_key_export] }
relationships:
- type: cloudify.relationships.depends_on
target: agent_key

agent_key:
type: cloudify.keys.nodes.RSAKey
properties:
resource_config:
key_name: { get_input: agent_key_name }
openssh_format: true
use_secret_store: true
use_secrets_if_exist: true
interfaces:
cloudify.interfaces.lifecycle:
create:
implementation: keys.cloudify_ssh_key.operations.create
inputs:
store_private_key_material: true

Loading

0 comments on commit 32fec4f

Please sign in to comment.