Introduction
A deploy is a collection of several components:
Inventories. Collections of hosts, against which your scripts run. Either defined by a file, or by specifying a single hostname like
root@example.com
for ad-hoc runs.Hosts. Host definitions allow you to assign variables and groups to specific hosts.
Groups. Hosts inherit the variables defined by the groups they belong to. All hosts implicitly belong to the
all
group, which can be used to define global variables.Scripts. Regular python scripts specifying what should be done on the remote hosts.
Fora always requires an inventory and a script to run. Here is an example using each of the above components:
# A list of your hosts.
hosts = [ dict(url="ssh://myhost.com", groups=["web"]) ]
Deploy structure
The general deploy structure is very flexible. There are only two things to keep in mind:
The working directory of a script is always its containing folder, so relative paths will work as expected. There is no definite root directory for a deploy.
Host and group definitions are always expected to be in the
hosts/
andgroups/
folders relative to the inventory file.
We recommend one of the following layouts for larger scale infrastructure management:
While a single deploy.py
would be truly minimal, this is a reasonable starting point to extend from.
./
├─ hosts/ # Host specific configuration
│ └─ localhost.py
├─ inventory.py # A list of all managed hosts
└─ deploy.py # The main deploy script
You can use fora --init <layout>
in an empty directory to initialize it with a specific deploy structure. See the included Examples to see how different layouts may be used.
Last updated