Facts IndexΒΆ
pyinfra
uses facts to determine the existing state of a remote server. Operations use this information to generate commands which alter the state. Facts are read-only and is populated at the beginning of the deploy.
Facts can be executed/tested via the command line:
# Example how to get multiple facts from a server myhost.com
pyinfra myhost.com fact date another_fact ...
If you want to see all facts:
# Show all of the facts from myhost.com
pyinfra myhost.com all-facts
If you want to pass an argument to a fact, use : then the argument. For example:
# See if the package 'openssh-server' is installed servers myhost.com and myhost2.com
pyinfra myhost.com,myhost2.com fact deb_package:openssh-server
You can leverage facts as part of a deploy like this:
# If this is an Ubuntu server
if host.fact.linux_name == 'Ubuntu':
apt.packages(...)
Want a new fact? Check out the writing facts guide.
Facts, like operations, are namespaced as different modules - shortcuts to each of these can be found in the sidebar.
- Apk Facts
- Apt Facts
- Brew Facts
- Bsdinit Facts
- Choco Facts
- Deb Facts
- Dnf Facts
- Docker Facts
- Files Facts
- Gem Facts
- Git Facts
- Gpg Facts
- Hardware Facts
- Iptables Facts
- Launchd Facts
- Lxd Facts
- Mysql Facts
- Npm Facts
- Pacman Facts
- Pip Facts
- Pkg Facts
- Postgresql Facts
- Rpm Facts
- Server Facts
- Systemd Facts
- Sysvinit Facts
- Upstart Facts
- Vzctl Facts
- Windows Facts
windows_aliases
windows_bios
windows_computer_info
windows_date
windows_home
windows_hostname
windows_hotfixes
windows_installer_applications
windows_last_reboot
windows_local_drives_info
windows_local_groups
windows_logged_in_user_info
windows_logon_session_info
windows_network_configuration
windows_os
windows_os_version
windows_processes
windows_processors
windows_service
windows_services
windows_system_type
windows_where
- Windows_Files Facts
- Xbps Facts
- Yum Facts
- Zypper Facts