Skip to content

Instantly share code, notes, and snippets.

@mies
Created April 9, 2016 16:20
Show Gist options
  • Save mies/1b27a60cba06e26112494a874dd37fb9 to your computer and use it in GitHub Desktop.
Save mies/1b27a60cba06e26112494a874dd37fb9 to your computer and use it in GitHub Desktop.
Droplet anchor IP configuration for CoreOS cloud-config on Digital Ocean
#cloud-config
coreos:
units:
# Explicit anchor IP configuration required on CoreOS stable droplet.
# <https://www.digitalocean.com/community/tutorials/how-to-enable-floating-ips-on-an-older-droplet>
- name: droplet-anchor-ip.service
command: start
content: |
[Unit]
Description=Droplet anchor IP
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/usr/bin/sh -c "anchor_ipv4=$(curl --silent http://169.254.169.254/metadata/v1/interfaces/public/0/anchor_ipv4/address); ip addr | grep --silent $${anchor_ipv4} || ip addr add $${anchor_ipv4}/16 dev eth0"
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment