Skip to main content
The server module takes care of os-level state. Targets POSIX compatibility, tested on Linux/BSD.

Functions

server.reboot

Reboot the server and wait for reconnection.

server.wait

Waits for a port to come active on the target machine. Requires netstat, checks every second.

server.shell

Run raw shell code on server during a deploy.

server.script

Upload and execute a local script on the remote host.

server.script_template

Generate, upload and execute a local script template on the remote host.

server.modprobe

Load/unload kernel modules.

server.mount

Manage mounted filesystems.
This operation does not attempt to modify the on disk fstab file - for that you should use the files.line operation.

server.hostname

Set the system hostname using hostnamectl or hostname on older systems.

server.timezone

Set the system timezone.

server.sysctl

Edit sysctl configuration.

server.service

Manage the state of services. This command checks for the presence of all the Linux init systems pyinfra can handle and executes the relevant operation.

server.packages

Add or remove system packages. This command checks for the presence of all the system package managers pyinfra can handle and executes the relevant operation.

server.group

Add/remove system groups.

server.user

Add/remove/update system users & their ssh authorized_keys.

server.locale

Enable/Disable locale.

Examples