Cloud-config auto join rancher and hostname

I am getting there with setting up my rancher envt. I have a cloud-config.yml with all the items I want in it for my hosts.

Two questions though please.

  1. If i dont add a hostname, every host has the same same. Is that a issue?

  2. Can I add this line to my cloud-cofig file (somehow), so I dont have to do it manually?
    sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.6 http://rancher:8080/v1/scripts/FA643536EDF:148334545000:t3K454mVE
    Or would I run into issue with version changes etc.

thanks

I’m trying to accomplish the same goal, but I can’t figure out how. Did you ever managed to get it working?

My (non-working) cloud config is:

#cloud-config
write_files:
- path: /etc/rc.local
permissions: “0755”
owner: root
content: |
#!/bin/bash
wait-for-docker
docker run -d --privileged --restart=unless-stopped --net=host -v / etc/kubernetes:/etc/kubernetes -v /var/run:/var/run rancher/rancher-agent:v2.0. 2 --server https://_rancher_host --token token --ca-checksum checksum --etcd --controlplane --worker