Inventories
Declaring hosts
hosts = ["host.example.com", # same as ssh://host.example.com. The host's name will be deduced as `host.example.com`
"root@localhost", # same as ssh://root@localhost. The hosts' name will be deduced as `localhost`
"ssh:root@localhost", # same as ssh://root@localhost.
"local:mymachine"] # Uses a the local connector which runs on the current machine as the user executing fora.# Instead of using `dict`, you can use this typed variant if you like.
from fora.types import HostDeclaration
hosts = [dict(url="host.example.com", groups=["desktops"]),
dict(name="host1"), # Tries to use hosts/host1.py if it exists.
dict(name="web1", file="hosts/web.py"), # Requires hosts/web.py
dict(name="web2", file="hosts/web.py"), # Requires hosts/web.py
dict(name="web3", file="hosts/web.py")] # Requires hosts/web.pyDeclaring groups
# Instead of using `dict`, you can use these typed variants if you like.
from fora.types import HostDeclaration, GroupDeclaration
hosts = [dict(name="host1", groups=["desktops", "archlinux"]),
dict(name="host2", groups=["desktops", "gentoo"])]
# We could omit this definition, if we didn't want to add inter-group
# dependencies. We for example want to make sure that the desktops group
# is evaluated after # any of the OS groups, to allow it to modify
# variables defined by the respective OS group.
groups = [dict(name="desktops", after=["archlinux", "gentoo"]),
"archlinux",
"gentoo"]Inspecting an inventory
Setting global variables from the inventory
Overwriting other behavior
Last updated