Skip to content

Instantly share code, notes, and snippets.

@ispyinternet
Last active January 22, 2016 01:13
Show Gist options
  • Save ispyinternet/eeb0ba08a7e5914efab5 to your computer and use it in GitHub Desktop.
Save ispyinternet/eeb0ba08a7e5914efab5 to your computer and use it in GitHub Desktop.
Cloud Config to boot rancher-agent on AWS RancherOS
#cloud-config
write_files:
- path: /etc/rc.local
permissions: "0755"
owner: root
content: |
#!/bin/bash
for i in {1..20}
do
docker info && break
sleep 1
done
sudo docker run -d -e CATTLE_HOST_LABELS="spotinst.instanceId=`wget -qO- http://169.254.169.254/latest/meta-data/instance-id`" --privileged -v /var/run/docker.sock:/var/run/docker.sock rancher/agent:v0.8.2 http://10.0.0.125:9080/v1/scripts/xxxxxxxx
wget "https://api.hipchat.com/v1/rooms/message?message=NEW+RANCHER+CONTAINER+LAUNCHED+(INSTANCE=`wget -qO- http://169.254.169.254/latest/meta-data/instance-id`+IP=`ifconfig eth0 | grep inet | grep -v inet6 | awk '{print $2}'`)+&auth_token=API_TOKEN&room_id=ROOM_ID&from=Spotinst+Launch"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment