# Useful python script to add a host to Rancher

**URL:** <https://forums.suse.com/t/useful-python-script-to-add-a-host-to-rancher/381>\
**Category:** Rancher 1.x\
**Created:** [September 2, 2015, 12:06pm UTC](https://forums.suse.com/t/useful-python-script-to-add-a-host-to-rancher/381 "2015-09-02T12:06:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kiboro](https://avatars.discourse-cdn.com/v4/letter/k/7993a0/32.png) [@kiboro](https://forums.suse.com/u/kiboro)\
**Post date:** [September 2, 2015, 12:06pm UTC](https://forums.suse.com/t/useful-python-script-to-add-a-host-to-rancher/381/1 "2015-09-02T12:06:45Z")

</div>

Just posting this to be helpful. We run our own virtualised platform and I deploy Docker hosts using Puppet. Here’s a link to a short Python script which gets a new registration token from Rancher and then starts the agent to add this host to Rancher. This was that last part of the puzzle to get automatic local deployment of hosts.

[http://pastebin.com/zmBiJA1j](http://pastebin.com/zmBiJA1j)
