The *nbd-server* role configures a machine as a Network Block Device (NDB) server, using the reference `nbd-server` implementation. It configures a systemd socket unit to listen on the port and accept incoming connections, and a template service unit for systemd to instantiate and pass each incoming connection. The reference `nbd-server` is actually not very good. It does not clean up closed connections reliably, especially if the client disconnects unexpectedly. Fortunately, systemd provides the necessary tools to work around these bugs. Specifically, spawning one process per connection allows processes to be killed externally. Further, since systemd creates the listening socket, it can control the keep-alive interval. By setting this to a rather low value, we can clean up server processes for disconnected clients more quickly. Configuration of the server itself is minimal; most of the configuration is done on a per-export basis using drop-in configuration files. Other Ansible roles should create these configuration files to configure application-specific exports. Nothing needs to be reloaded or restarted for changes to take effect; the next incoming connection will spawn a new process, which will use the latest configuration file automatically.
5 lines
115 B
Django/Jinja
5 lines
115 B
Django/Jinja
[generic]
|
|
port = 0
|
|
allowlist = {{ nbd_server_allow_list|bool|string|lower }}
|
|
includedir = /etc/nbd-server/config.d
|