Skip to content

Instantly share code, notes, and snippets.

@evandbrown
Created September 22, 2015 04:12
Show Gist options
  • Save evandbrown/b9877646aa70bceb0c1e to your computer and use it in GitHub Desktop.
Save evandbrown/b9877646aa70bceb0c1e to your computer and use it in GitHub Desktop.
---
imports:
- path: manynodes.jinja
resources:
-
name: manynodes
type: manynodes.jinja
properties:
image: https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-8-jessie-v20150818
region: us-central1
machine_type: n1-standard-1
zones:
us-central1-f:
num_servers: 50
us-central1-b:
num_servers: 50
{% set INSTANCE_TEMPLATE = env["name"] + "-it" %}
{% set INSTANCE_GROUP = env["name"] + "-ig" %}
resources:
- name: {{ INSTANCE_TEMPLATE }}
type: compute.v1.instanceTemplate
properties:
project: {{ env["project"] }}
properties:
machineType: {{ properties["machine_type"] }}
disks:
- deviceName: boot
type: PERSISTENT
boot: true
autoDelete: true
initializeParams:
sourceImage: {{ properties["image"] }}
networkInterfaces:
- network: https://www.googleapis.com/compute/v1/projects/{{ env["project"] }}/global/networks/default
accessConfigs:
- name: External NAT
type: ONE_TO_ONE_NAT
serviceAccounts:
- email: "default"
scopes:
- "https://www.googleapis.com/auth/compute"
tags:
items:
- sometag
metadata:
items:
- key: startup-script
value: |
#! /bin/bash
apt-get update -y
{% for zone in properties["zones"] %}
# Instance Group Manager
- name: {{ INSTANCE_GROUP + "-" + zone }}
type: compute.v1.instanceGroupManager
properties:
zone: {{ zone }}
targetSize: {{ properties["zones"][zone]["num_servers"] }}
size: {{ properties["zones"][zone]["num_servers"] }}
baseInstanceName: {{ env["name"] }}
instanceTemplate: $(ref.{{ INSTANCE_TEMPLATE }}.selfLink)
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment