Skip to content

Instantly share code, notes, and snippets.

@chrissnell
Created March 10, 2015 23:48
Show Gist options
  • Save chrissnell/6c834a76e3459d26078c to your computer and use it in GitHub Desktop.
Save chrissnell/6c834a76e3459d26078c to your computer and use it in GitHub Desktop.
#cloud-config
write_files:
- path: /run/cloud-config.yml
permissions: '0644'
content: |
#cloud-config
coreos:
fleet:
# Need to override this in a unit like we did for etcd below
# used for fleetctl ssh command
# public-ip: $_private_ipv4
metadata: "role=services"
units:
- name: fleet.service
command: start
coreos:
units:
- name: setup-network-environment.service
command: start
runtime: true
content: |
[Unit]
Description=Setup networking environment by pulling IP from ifconfig(8)
Documentation=https://github.com/kelseyhightower/setup-network-environment
Requires=network-online.target
After=network-online.target
[Service]
ExecStartPre=-/usr/bin/mkdir -p /opt/bin
ExecStartPre=/usr/bin/wget -N -P /opt/bin http://REDACTED/coreos-setup-network-environment-linux-amd64
ExecStartPre=/usr/bin/chmod +x /opt/bin/coreos-setup-network-environment-linux-amd64
ExecStart=/opt/bin/coreos-setup-network-environment-linux-amd64
RemainAfterExit=yes
Type=oneshot
- name: etcd.service
command: start
content: |
[Unit]
Description=etcd
Requires=setup-network-environment.service
After=setup-network-environment.service
ConditionFileNotEmpty=/etc/network-environment
ReloadPropagatedFrom=setup-network-environment.service
[Service]
User=etcd
PermissionsStartOnly=true
EnvironmentFile=/etc/network-environment
ExecStart=/usr/bin/etcd -vv -name etcd -bind-addr 0.0.0.0 -addr ${DEFAULT_IPV4}:4001 -peer-addr ${DEFAULT_IPV4}:7001 -data-dir /var/lib/etcd -max-retry-attempts 20 -discovery https://discovery.etcd.io/b9b4d6f8054c1ecba61c5a7cf6f0bc79
Restart=always
RestartSec=10s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment