Skip to content

Instantly share code, notes, and snippets.

@grantorchard
Created May 2, 2019 03:45
Show Gist options
  • Save grantorchard/cc7759f662d068c49374c15f6b8bee62 to your computer and use it in GitHub Desktop.
Save grantorchard/cc7759f662d068c49374c15f6b8bee62 to your computer and use it in GitHub Desktop.
Working with Cloud Assembly inputs
formatVersion: 1
inputs:
image:
type: string
title: Operating System
enum:
- ubuntu 16.04
- ubuntu 18.04
default: ubuntu 16.04
count:
type: integer
title: Machine Count
minimum: 2
maximum: 5
default: 2
size:
type: string
title: Machine size
description: Resource requirements for your workload.
enum:
- small
- medium
default: small
tags:
type: array
title: Tags
description: Freeform tags that you would like attached to the provisioned resources.
items:
type: object
properties:
key:
type: string
title: Key
value:
type: string
title: Value
platform:
type: string
title: Deploy to
oneOf:
- title: AWS
const: 'platform:aws'
- title: Azure
const: 'platform:azure'
- title: vSphere
const: 'platform:vsphere'
username:
title: User Account
type: string
description: Name of the user account to be created. Can only contain letters and numbers.
pattern: '^[a-zA-Z0-9]+$'
shell:
title: Default Shell
type: string
enum:
- /bin/bash
- /bin/sh
default: /bin/bash
ssh_public_key:
type: string
title: SSH public key
encrypted: true
password:
type: string
title: Password
description: The initial password that will be required to logon to the machine. Will be set to reset on first login.
writeOnly: true
public_ip:
type: boolean
title: Assign public IP address
description: Choose whether your machine should be internet facing.
default: false
resources:
Machine_1:
type: Cloud.Machine
properties:
count: '${input.count}'
image: '${input.image}'
flavor: '${input.size}'
tags: '${input.tags}'
constraints:
- tag: '${input.platform}'
cloudConfig: |
#cloud-config
users:
- name: ${input.username}
shell: ${input.shell}
groups: sudo
sudo: ['ALL=(ALL) NOPASSWD:ALL']
ssh-authorized_keys:
- ${input.ssh_public_key}
passwd: ${input.password}
chpasswd: {expire: True}
networks:
- name: '${resource.Network_1.name}'
assignPublicIpAddress: '${input.public_ip}'
Network_1:
type: Cloud.Network
properties:
name: net1
networkType: existing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment