Skip to content

Instantly share code, notes, and snippets.

@codyde
Created May 7, 2019 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codyde/80b0cfdf0f944fbe667bf74be0786d07 to your computer and use it in GitHub Desktop.
Save codyde/80b0cfdf0f944fbe667bf74be0786d07 to your computer and use it in GitHub Desktop.
Sample's of various blueprint expression content (operators, base64 encode, to lower, etc...)
name: CAS Expressions Demo
version: 4
formatVersion: 1
inputs:
environment:
type: string
enum:
- AWS
- vSphere
- Azure
- VMC
- GCP
default: vSphere
sshKey:
type: string
maxLength: 500
envsize:
type: string
enum:
- Small
- Large
resources:
frontend:
type: Cloud.Machine
properties:
folderName: '${input.environment == "VMC" ? "Workload" : ""}'
image: ubuntu
flavor: medium
count: '${input.envsize == "Small" ? 1 : 2}'
remoteAccess:
authentication: publicPrivateKey
sshKey: '${input.sshKey}'
cloudConfig: |
packages:
- nginx
runcmd:
- echo ${resource.apitier.networks[0].address}
constraints:
- tag: '${"env:" + to_lower(input.environment)}'
networks:
- name: '${resource.Cloud_Network_1.name}'
apitier:
type: Cloud.Machine
properties:
folderName: '${input.environment == "VMC" ? "Workload" : ""}'
image: ubuntu
flavor: small
cloudConfig: |
#cloud-config
runcmd:
- export apikey=${base64_encode(input.username:input.password)}
- curl -i -H 'Accept:application/json' -H 'Authorization:Basic :$apikey' http://example.com
remoteAccess:
authentication: publicPrivateKey
sshKey: '${input.sshKey}'
constraints:
- tag: '${"env:" + to_lower(input.environment)}'
networks:
- name: '${resource.Cloud_Network_1.name}'
Cloud_Network_1:
type: Cloud.Network
properties:
name: Default
networkType: existing
constraints:
- tag: '${"env:" + to_lower(input.environment)}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment