Skip to content

Instantly share code, notes, and snippets.

@neilmillard
Created October 19, 2015 10:52
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 neilmillard/774db984e7c396df66be to your computer and use it in GitHub Desktop.
Save neilmillard/774db984e7c396df66be to your computer and use it in GitHub Desktop.
#!/bin/bash
# Find the name from the user data passed in on instance creation
USER=$(curl -s "http://169.254.169.254/latest/user-data")
IFS=':' read -ra UDATA <<< "$USER"
# Find the instance ID from the meta data api
ID=$(curl -s "http://169.254.169.254/latest/meta-data/instance-id")
CERTNAME=${UDATA[1]}.$ID.aws
echo "Running Puppet for certname: " $CERTNAME
puppet agent -t --certname=$CERTNAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment