Skip to content

Instantly share code, notes, and snippets.

@scottslowe
Last active August 29, 2015 14:07
Show Gist options
  • Save scottslowe/ea3fdb28d8ad27f58e07 to your computer and use it in GitHub Desktop.
Save scottslowe/ea3fdb28d8ad27f58e07 to your computer and use it in GitHub Desktop.
This Heat template spins up three CoreOS Linux instances, configures them via cloud-init/cloud-config to create an etcd cluster and start both etcd and fleet, and configures Docker to listen on a TCP socket. It requires an existing Neutron network, an existing Glance image for CoreOS, a security group allowing the appropriate traffic, and a disc…
heat_template_version: 2013-05-23
description: >
A Heat template to add CoreOS instances to an existing network and configure them via cloud-init/cloud-config
parameters:
network_id:
type: string
label: Neutron network ID
description: ID of existing Neutron network to use
default: dd6de1d2-735e-4b94-963b-b79aae7bcf1a
image_id:
type: string
label: Glance Image ID
description: ID of existing Glance image to use
default: e9695a76-f40d-4f56-bc03-f99031bd81aa
resources:
coreos_init:
type: OS::Heat::CloudConfig
properties:
cloud_config:
coreos:
etcd:
discovery: https://discovery.etcd.io/7df52496d16c69d0ed03cc48aa2eb6bd
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
units:
- name: etcd.service
command: start
- name: fleet.service
command: start
- name: docker-tcp.socket
command: start
enable: yes
content: |
[Unit]
Description=TCP socket for Docker API
[Socket]
ListenStream=2345
BindIPv6Only=both
Service=docker.service
[Install]
WantedBy=sockets.target
- name: enable-docker-tcp.service
command: start
content: |
[Unit]
Description=Enable TCP socket for Docker API
[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl enable docker-tcp.socket
instance0_port0:
type: OS::Neutron::Port
properties:
admin_state_up: true
network_id: { get_param: network_id }
security_groups:
- 74518432-12ba-4bdb-8d22-09c616b158b0
instance1_port0:
type: OS::Neutron::Port
properties:
admin_state_up: true
network_id: { get_param: network_id }
security_groups:
- 74518432-12ba-4bdb-8d22-09c616b158b0
instance2_port0:
type: OS::Neutron::Port
properties:
admin_state_up: true
network_id: { get_param: network_id }
security_groups:
- 74518432-12ba-4bdb-8d22-09c616b158b0
instance0:
type: OS::Nova::Server
properties:
name: coreos-instance-0
image: { get_param: image_id }
flavor: m1.small
networks:
- port: { get_resource: instance0_port0 }
key_name: lab
user_data_format: RAW
user_data:
get_resource: coreos_init
instance1:
type: OS::Nova::Server
properties:
name: coreos-instance-1
image: { get_param: image_id }
flavor: m1.small
networks:
- port: { get_resource: instance1_port0 }
key_name: lab
user_data_format: RAW
user_data:
get_resource: coreos_init
instance2:
type: OS::Nova::Server
properties:
name: coreos-instance-2
image: { get_param: image_id }
flavor: m1.small
networks:
- port: { get_resource: instance2_port0 }
key_name: lab
user_data_format: RAW
user_data:
get_resource: coreos_init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment