This example shows how to use roles within different infrastructures. There are one role and one infrastructure defined in fabfile.py. But you can define as many additional roles and infrastructures as you need.
- Fabricio 0.4.7 or greater
- Vagrant
- One from the list of Vagrant supported providers (this example was tested with VirtualBox)
- fabfile.py, Fabricio configuration
- README.md, this file
- Vagrantfile, Vagrant config
Run vagrant up
and wait until VM will be created.
fab --list
To deploy to a particular infrastructure you need to provide its name before any other command:
fab vagrant app
This command will start deploy to the vagrant
infrastructure.
Also you can use vagrant.confirm
command to skip confirmation dialog and start tasks execution immediately.
If no infrastructure selected then Fabricio will use default roles definition (in that case you should manually set default roles in your fabfile.py
, see Fabric documentation). Also if there is no hosts found for a role then any task which needs to be executed on a remote host will be skipped.
Same configuration can be deployed to localhost:
fab localhost app
even without SSH daemon enabled:
fab localhost:force_local=yes app
The latter is possible due to special "force_local" parameter passed to localhost
infrastructure definition. See fabfile.py for details.
Any Fabricio command can be executed in parallel mode. This mode provides advantages when you have more then one host to deploy to. Use --parallel
option if you want to run command on all hosts simultaneously:
fab --parallel vagrant app
See "Hello World" Customization section.