Skip to content

Instantly share code, notes, and snippets.

@arthur-c
Created August 6, 2015 16:30
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 arthur-c/36d986627dcce3256589 to your computer and use it in GitHub Desktop.
Save arthur-c/36d986627dcce3256589 to your computer and use it in GitHub Desktop.
#cloud-config
coreos:
update:
reboot-strategy: best-effort
# etcd2:
# initial-cluster: coreos-etcd-01=http://172.31.64.5:2380,coreos-etcd-02=http://172.31.65.5:2380,coreos-etcd-03=http://172.31.66.5:2380
# initial-cluster-token: etcd-cluster-01
# initial-advertise-peer-urls: http://privateip:2380
# advertise-client-urls: http://privateip:2379
# listen on both the official ports and the legacy ports
# legacy ports can be omitted if your application doesn't depend on them
# listen-client-urls: http://0.0.0.0:2379
# listen-peer-urls: http://0.0.0.0:2380
fleet:
public-ip: $private_ipv4
etcd_servers: http://172.31.64.5:2379,http://172.31.65.5:2379,http://172.31.66.5:2379
metadata: id={{ hostname }},az={{ zone }},flavor={{ instance_type }},role={{ role }}
units:
- name: etcd2.service
command: stop
- name: etcd.service
command: stop
- name: fleet.service
command: start
- name: flanneld.service
drop-ins:
- name: 50-network-config.conf
content: |
[Unit]
Description=Setup flannel network
Wants=setup-etcdctl-env.service
After=setup-etcdctl-env.service
[Service]
Environment=AWS_ACCESS_KEY_ID=XXXXXXX
Environment=AWS_SECRET_ACCESS_KEY=XXXX
EnvironmentFile=/etc/environment
ExecStartPre=/usr/bin/etcdctl set /coreos.com/network/config '{ "Network": "10.1.0.0/16", "Backend": {"Type": "aws-vpc"} }'
command: start
- name: setup-etcdctl-env.service
command: start
content: |
[Unit]
Description=Setup etcdctl env vars
Wants=coreos-setup-environment.service
After=coreos-setup-environment.service
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/bash -c "source /etc/profile.d/etcd-envvars.sh; env | grep -E 'ETCDCTL_PEERS' >> /etc/environment"
[Install]
WantedBy=multi-user.target
- name: setup-platform-env.service
command: start
content: |
[Unit]
Description=Setup platform env vars
Wants=setup-etcdctl-env.service
After=setup-etcdctl-env.service
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/bash -c "echo PLATFORM={{ platform }} >> /etc/environment"
[Install]
WantedBy=multi-user.target
write_files:
- path: /etc/profile.d/etcd-envvars.sh
permissions: 0644
owner: root
content: |
# Override default etcd host (127.0.0.0:4001),
# these env vars are necessary for tools that talk to etcd.
# Also used by setup-etcdctl-env.service to generate envs in /etc/environment file
export ETCDCTL_PEERS="http://172.31.64.5:2379,http://172.31.65.5:2379,http://172.31.66.5:2379"
hostname: {{ hostname }}
ssh_authorized_keys:
- ssh-rsa XXX
- ssh-dss XXX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment