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

Use environment variables in inventory #97

Open
bborysenko opened this issue Sep 23, 2016 · 3 comments · May be fixed by #184
Open

Use environment variables in inventory #97

bborysenko opened this issue Sep 23, 2016 · 3 comments · May be fixed by #184

Comments

@bborysenko
Copy link

I would like to be able dynamically generate inventory based on environment variables:

# Supfile

---
env:
  GCLOUD_INSTANCE_NAME: loadtesing-template

networks:
  cloud:
    inventory:
      echo "deploy@$(gcloud compute instances describe $GCLOUD_INSTANCE_NAME | grep natIP | awk '{print $2}'):22"

But it doesn't work:

$ sup
usage: gcloud compute instances describe  NAME [optional flags]
ERROR: (gcloud.compute.instances.describe) too few arguments
Networks:
- cloud
    - deploy@:22

$ sup -e GCLOUD_INSTANCE_NAME=loadtesing-master
usage: gcloud compute instances describe  NAME [optional flags]
ERROR: (gcloud.compute.instances.describe) too few arguments
Networks:
- cloud
    - deploy@:22

Is there some way to do it?

@bborysenko
Copy link
Author

Just in few minutes later I realized that it can be done in this way:

$ GCLOUD_INSTANCE_NAME=loadtesing-master sup -e GCLOUD_INSTANCE_NAME=loadtesing-master 

But in this case I have to specify this var twice, what is bit annoying.

@VojtechVitek
Copy link
Collaborator

makes sense -- are you going to submit a PR?

@bborysenko
Copy link
Author

Sorry, but no. Have to learn golang before ...

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

Successfully merging a pull request may close this issue.

2 participants