Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

How can I use metadata variables from ec2 datasource #1178

Closed
boshido opened this issue Aug 23, 2016 · 2 comments
Closed

How can I use metadata variables from ec2 datasource #1178

boshido opened this issue Aug 23, 2016 · 2 comments

Comments

@boshido
Copy link

boshido commented Aug 23, 2016

RancherOS Version: (ros os version)
ros -v = ros version v0.5.0

Where are you running RancherOS? (docker-machine, AWS, GCE, baremetal, etc.)
AWS

Here is my cloud-config

#cloud-config
rancher:
  cloud_init:
    datasources:
      - ec2
  services:
    register:
      image: rancher/agent:v1.0.2
      privileged: true
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock
        - /var/lib/rancher:/var/lib/rancher
      environment:
        CATTLE_HOST_LABELS: "access_mode=private"
        CATTLE_AGENT_IP: $private_ipv4
      command:
        - http://blablabla:blablabla

As you see I used $private_ipv4 to assign value to CATTLE_AGENT_IP and It was not work.

The problem is I found this technical from https://forums.rancher.com/t/ec2-metadata-and-cloud-init/2975 that was CoreOS technical long time ago and I'm not sure where are the others technical to use on RancherOS.

I read rancher cloud-config document "http://docs.rancher.com/os/cloud-config/" and It just said that I can set the ec2 as datasource but it does not said about what the benefit of it (How to use the mapped metadata).

I read cloud-init config document "http://cloudinit.readthedocs.io/en/latest/topics/datasources.html" but it didn't help me at all

Is my understanding correct that when I map the ec2 datasource to cloud-init, I could use the data from mapped metadata from environment variable or function or any technicals that give me the data ?

@boshido
Copy link
Author

boshido commented Oct 25, 2016

Any updates on this issue ?
After faced this problem I had to move to coreOS that was not what I really wanted.

@ibuildthecloud
Copy link
Contributor

This really should work.... After boot, what is in /var/lib/rancher/conf/metadata and what is the output of sudo ros config export

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants