pressly / sup

Super simple deployment tool - think of it like 'make' for a network of servers
https://pressly.github.io/sup
MIT License
2.48k stars 178 forks source link

Use environment variables in inventory #97

Open bborysenko opened 7 years ago

bborysenko commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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

bborysenko commented 7 years ago

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