How to add a custom host using Rancher CLI

Hi there,

This is ma first post in this forums and I want to say hello…

I searched a bit within this forum but I couldn’t find anything related to my topic.

I’m actually trying to automatically deploy a pretty complex web application using terraform for the cloud provider architecture, rancher cli for the rancher part all wrapped within shell scripts.

I need to automatically add a “custom host” in the rancher UI using rancher-cli or a shell script. I have already tried something curl requests I found using search engines but I haven 't come to a solution yet.
Is there some way to get the rancher authentication token for the docker rund command by rancher-cli?

Other questions which are open are:

  • how can I automatically deploy a Rancher LoadBalancer?

  • How can I define a predefined startup procedure as the depends_on in docker compose files gets filtered out when I import it in Rancher.

  • Is it also somehow possible to predefine Health Check rules for an automated deployment?

Hopefully this was not too much for my first post.

Hey bga

Did you get a solution for it? We are also having a similar requirement. Our hosts automatically added into existing ENV using aws auto-scaling.
However, if we want to create new ENV in rancher using CLI and look to add a custom host, we need CLI option.

Let us know if you have figured out.

–Tarun Prakash


I managed it using terraform for deployment. It provides a Rancher
Provider. Afterwards additional Hosts are managed using ansible.
Using scaling based in monitoing i added a Hook URL which gets triggered by
Monitoring app anderen then increases Thema amount of Servers anderen
afterwards increases Thema Numbers of docker instances managed by rancher.

Hope u got the idea


This link ( helped me.
I have tested it, working well for me.