The docs are not clear on how to create a generic driver host via the CLI. It references the docker generic params (https://docs.docker.com/machine/drivers/generic/)
RANCHER HOSTS CREATE
The rancher hosts create command allows you to create hosts. When creating hosts, you will be calling a Docker Machine command, and will need to pass in the same options needed for the Docker Machine driver.
But the docker params are not accepted by the rancher command as below:
rancher hosts create --driver generic --generic-ip-address 172.16.0.7 --generic-ssh-key ~/.ssh/id_rancher --generic-ssh-user ubuntu
FATA[0000] flag provided but not defined: -generic-ip-address
Any help is appreciated.
+++++ UPDATE
I found a workaround in the meantime. bit of a hack but it will do until the rancher CLI issue is resolved. The approach is to download the same content as delivered via the UI under ‘5. Copy, paste, and run the command below to register the host with Rancher:". "nuclab’ below is the name of my environment.
export agents="172.16.0.7 172.16.0.8 172.16.0.9"
export RANCHER_ENVIRONMENT=$(rancher env | awk “/nuclab/ {print $1}”)
command=$(curl -s “http://172.16.0.2:8080/v2-beta/projects/$RANCHER_ENVIRONMENT/registrationtokens?state=active&limit=-1&sort=name” | jq -r ‘.data[0].command’)
for agent in $agents; do
ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ubuntu@${agent} $command
done
+++++ End of update
rancher CLI version v0.6.3
ubuntu xenial