Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOMAD_HOSTNAME env var #538

Closed
adrianlop opened this issue Dec 7, 2015 · 4 comments · Fixed by #653
Closed

NOMAD_HOSTNAME env var #538

adrianlop opened this issue Dec 7, 2015 · 4 comments · Fixed by #653

Comments

@adrianlop
Copy link
Contributor

Hi,
I think it is useful to have this NOMAD_HOSTNAME env var imported into the Docker containers.
Use case example: a log shipper or a message broker so you can attach the name of the host where the container is running into a "hostname" field.

What do you think? can you make it possible guys? :)
Thank you.

@diptanu
Copy link
Contributor

diptanu commented Dec 9, 2015

@poll0rz We have decided to do this in a generic way

So using the env block you will be able to reference Environment Variables that the Nomad client knows about -

env {
   NOMAD_HOST=$HOSTNAME
}

So if the Host name environment variable was set in the environment of the Nomad client an user can inject it in his job.

That way you can inject any arbitrary environment variable without Nomad core changing. This is also useful in AWS, where you might want to inject the Region, Zone, Ec2 instance id etc.

@diptanu
Copy link
Contributor

diptanu commented Dec 9, 2015

#448 should be fixed with this

@adrianlop
Copy link
Contributor Author

hellyeah, this way we can pass a lot of useful info to the task, not only the hostname.
really niiiice approach, thank you!!!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants