User Data for automated RancherOS instances
- Login to Rancher
- Add New
- From step #5 on screen, grab the URL only. It looks something like: http://rancher.domain.tld/v1/scripts/F3somethingA6:14something00:S9something2Q
#cloud-config rancher: services: register: priviledged: true volumes: - /var/run/docker.sock:/var/run/docker.sock image: rancher/agent command: http://rancher.domain.tld/v1/scripts/F3somethingA6:14something00:S9something2Q
Now when the instances start, they should automatically register with your Rancher server. I’ve noticed it takes 5 minutes or so for the systems to register once they are fully started. Remember that the instances will show as running in AWS very quickly but that doesn’t mean RancherOS is actually ready to operate yet. On first boot it has to pull down all the system docker containers before it gets to pulling down and launching the agent.
http://rancher.domain.tld/v1/registrationtokens and you’ll be able to pull down all details required for registration. The variables can then be easily passed into your automation solution of choice.
Remember: Treat your servers like cattle, not pets!