mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 18:03:04 +00:00
Merge pull request #25696 from aneeshusa/add-salt-minion-service
salt: Add minion service module
This commit is contained in:
commit
ea031fe7c1
@ -130,6 +130,7 @@
|
||||
./security/wrappers/default.nix
|
||||
./security/sudo.nix
|
||||
./services/admin/salt/master.nix
|
||||
./services/admin/salt/minion.nix
|
||||
./services/amqp/activemq/default.nix
|
||||
./services/amqp/rabbitmq.nix
|
||||
./services/audio/alsa.nix
|
||||
|
56
nixos/modules/services/admin/salt/minion.nix
Normal file
56
nixos/modules/services/admin/salt/minion.nix
Normal file
@ -0,0 +1,56 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.services.salt.minion;
|
||||
|
||||
fullConfig = lib.recursiveUpdate {
|
||||
# Provide defaults for some directories to allow an immutable config dir
|
||||
# NOTE: the config dir being immutable prevents `minion_id` caching
|
||||
|
||||
# Default is equivalent to /etc/salt/minion.d/*.conf
|
||||
default_include = "/var/lib/salt/minion.d/*.conf";
|
||||
# Default is in /etc/salt/pki/minion
|
||||
pki_dir = "/var/lib/salt/pki/minion";
|
||||
} cfg.configuration;
|
||||
configDir = pkgs.writeTextDir "minion" (builtins.toJSON fullConfig);
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
options = {
|
||||
services.salt.minion = {
|
||||
enable = mkEnableOption "Salt minion service";
|
||||
configuration = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
description = ''
|
||||
Salt minion configuration as Nix attribute set.
|
||||
See <link xlink:href="https://docs.saltstack.com/en/latest/ref/configuration/minion.html"/>
|
||||
for details.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [ salt ];
|
||||
systemd.services.salt-minion = {
|
||||
description = "Salt Minion";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
path = with pkgs; [
|
||||
utillinux
|
||||
];
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.salt}/bin/salt-minion --config-dir=${configDir}";
|
||||
LimitNOFILE = 8192;
|
||||
Type = "notify";
|
||||
NotifyAccess = "all";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user