Skip to content

Instantly share code, notes, and snippets.

@kgorskowski
Created July 10, 2015 10:37
Show Gist options
  • Save kgorskowski/1250b6e95419bce93e6a to your computer and use it in GitHub Desktop.
Save kgorskowski/1250b6e95419bce93e6a to your computer and use it in GitHub Desktop.
coreos cloud-config file for dynamically mount aws efs in the right availability zone
#cloud-config
write-files:
- path: /etc/conf.d/nfs
permissions: '0644'
content: |
OPTS_RPC_MOUNTD=""
users:
- name: XYZ
groups:
- sudo
- docker
ssh-authorized-keys:
- ssh-rsa XYZ
coreos:
etcd:
discovery: https://discovery.etcd.io/XYZ
peer-addr: $private_ipv4:7001
units:
- name: rpc-statd.service
command: start
enable: true
- name: mnt-efs.mount
content: |
[Mount]
What=AZ_ZONE.fs-XYZ.efs.AMAZON_REGION.amazonaws.com:/
Where=/mnt/efs
Type=nfs
- name: etcd.service
command: start
- name: fleet.service
command: start
- name: runcmd.service
command: start
content: |
[Unit]
Description=command
[Service]
Type=oneshot
ExecStart=/bin/sh -c "AZ_ZONE=$(curl -L http://169.254.169.254/latest/meta-data/placement/availability-zone); sed -i \"s/AZ_ZONE/$AZ_ZONE/\" /etc/systemd/system/mnt-efs.mount; systemctl daemon-reload; systemctl restart mnt-efs.mount"
@andymotta
Copy link

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment