Can we provisionned Hosts on openstack using Rancher-API instead of Rancher-UI?

I would like to automate Hosts pre-provisionned with rancher agent like I can do directly with docker-machine, but i don’t want to do it with the UI but directly using Rancher-cli ?

thanks

Hi All,

An other way : Can I talk directly to the Rancher API in order to get dynamically the “Add Host” command to un on my docker nodes in order to add rancher-agents to my cluster ?

thanks

See Is there a way to create a digital ocean host programmatically?

Hi Sebastian,

i’m not sure if this fits your requirements:

Just run this command on your new docker nodes:

Example:
sudo docker run -d --privileged -v /var/run/docker.sock:/var/run/docker.sock rancher/agent:v0.8.2 http://your.docker.host.com/v1/scripts/1BBCC398C3F6DC:1449738000000:zgBMn1M2jsszwhBbNsE

Obvious you have to “automate” this command after openstack has provisioned your new VM…

This CLI above is for all nodes the same… you just have to click one time on the “add-host” and copy this cli…

Hope that helps…

Hi @Flo_B,

thanks for reply, in fact it is that rancher url that I want to retrieve dynamically (or is this url note limited in time ? if I get this url and used it 2month or 1year later would it be stille valid ?)

thanks

There is a setting (not exposed in the UI) to configure the lifetime, it defaults to “forever” (10 years) by default but can be reduced to minutes if you wanted to lock it down.

@vincent thanks for reply, 10 years is ok for me :slight_smile: