Discussion:
[Fab-user] Does fabric have a better way to manager the hosts
bin
2018-09-04 09:30:36 UTC
Permalink
I think fabric should has a config file to keep the hosts.

when I run fabric task, all the hosts will pass to task as connection

-H flag is used to filter the target hosts

In this case, I need not to type fab -H host1,host2 deploy

Yes, It acts somehow like capistrano
Carl Waldbieser
2018-09-11 15:36:36 UTC
Permalink
There is nothing that stops your fabfile from reading a configuration file that has the hosts in it and setting `env.roledefs`. I use this for my own deployment scripts. I run it with a command line like:

$ DEPLOYER_CONFIG=./myapp-config.yml fab -R STAGE deploy_config

Where "DEPLOYER_CONFIG=./myapp-config.yml" sets an environment variable in my shell I can use to specify the config file, "-R STAGE" is the role-to-host mapping that is defined in the config file and used to configure `env.roledefs` in my fabfile, and "deploy_config" is the task that will be run.

You could also just have a default location for config files like `$HOME/.myconfig.json`, etc.

Thanks,
Carl Waldbieser

----- Original Message -----
From: "bin" <***@gmail.com>
To: "fab-user" <fab-***@nongnu.org>
Sent: Tuesday, 4 September, 2018 05:30:36
Subject: [Fab-user] Does fabric have a better way to manager the hosts

I think fabric should has a config file to keep the hosts.

when I run fabric task, all the hosts will pass to task as connection

-H flag is used to filter the target hosts

In this case, I need not to type fab -H host1,host2 deploy

Yes, It acts somehow like capistrano

Loading...