So here’s my scenario. I’d like to set some host labels on my rancher agent that is running on rancheros. These labels should be based off information from the ec2 metadata service as I’m running on AWS. I am very stuck as to how to make this happen in RancherOS. Here’s what I’ve tried:
- Use write_files to create a start.sh script that uses ros config to set rancher.environment.CATTLE_HOST_LABELS to what I need, then referencing said variable in my cloud-config like this:
…other docker stuff…
This doesn’t seem to work. I was assuming the ros env command was applied to services that you use cloud-config to run, but maybe not?
- Instead of using cloud-config, just set my user data to a simple bash script that runs the rancher agent container directly. In this scenario the container never launched.
Anyone got any better ideas on how I might achieve this?