summary refs log tree commit diff
path: root/nixos/modules/services/misc/ssm-agent.nix
diff options
context:
space:
mode:
authorJoe DeVivo <joe@devivo.com>2021-05-08 16:03:38 -0700
committerCole Helbling <cole.e.helbling@outlook.com>2021-05-10 13:16:41 -0700
commitbf92d0ec3794fcfb8b23bbeb5dd9bf50fbf97bc4 (patch)
tree7556fc9eadd5478ba75aeffb2b9eb70f9aa80fbf /nixos/modules/services/misc/ssm-agent.nix
parent27b4fd19ed41d6c747b8e4fc90a835757afd6558 (diff)
downloadnixpkgs-bf92d0ec3794fcfb8b23bbeb5dd9bf50fbf97bc4.tar
nixpkgs-bf92d0ec3794fcfb8b23bbeb5dd9bf50fbf97bc4.tar.gz
nixpkgs-bf92d0ec3794fcfb8b23bbeb5dd9bf50fbf97bc4.tar.bz2
nixpkgs-bf92d0ec3794fcfb8b23bbeb5dd9bf50fbf97bc4.tar.lz
nixpkgs-bf92d0ec3794fcfb8b23bbeb5dd9bf50fbf97bc4.tar.xz
nixpkgs-bf92d0ec3794fcfb8b23bbeb5dd9bf50fbf97bc4.tar.zst
nixpkgs-bf92d0ec3794fcfb8b23bbeb5dd9bf50fbf97bc4.zip
nixos/ssm-agent: conf files written to /etc
ssm-agent expects files in /etc/amazon/ssm. The pkg substitutes a location in
the nix store for those default files, but if we ever want to adjust this
configuration on NixOS, we'd need the ability to modify that file.

This change to the nixos module writes copies of the default files from the nix
store to /etc/amazon/ssm. Future versions can add config, but right now this
would allow users to at least write out a text value to
environment.etc."amazon/ssm/amazon-ssm-agent.json".text to provide
their own config.
Diffstat (limited to 'nixos/modules/services/misc/ssm-agent.nix')
-rw-r--r--nixos/modules/services/misc/ssm-agent.nix15
1 files changed, 11 insertions, 4 deletions
diff --git a/nixos/modules/services/misc/ssm-agent.nix b/nixos/modules/services/misc/ssm-agent.nix
index e50b07e0b86..c29d03d199b 100644
--- a/nixos/modules/services/misc/ssm-agent.nix
+++ b/nixos/modules/services/misc/ssm-agent.nix
@@ -22,8 +22,8 @@ in {
     package = mkOption {
       type = types.path;
       description = "The SSM agent package to use";
-      default = pkgs.ssm-agent;
-      defaultText = "pkgs.ssm-agent";
+      default = pkgs.ssm-agent.override { overrideEtc = false; };
+      defaultText = "pkgs.ssm-agent.override { overrideEtc = false; }";
     };
   };
 
@@ -37,8 +37,10 @@ in {
       serviceConfig = {
         ExecStart = "${cfg.package}/bin/amazon-ssm-agent";
         KillMode = "process";
-        Restart = "on-failure";
-        RestartSec = "15min";
+        # We want this restating pretty frequently. It could be our only means
+        # of accessing the instance.
+        Restart = "always";
+        RestartSec = "1min";
       };
     };
 
@@ -62,5 +64,10 @@ in {
       isNormalUser = true;
       group = "ssm-user";
     };
+
+    environment.etc."amazon/ssm/seelog.xml".source = "${cfg.package}/seelog.xml.template";
+
+    environment.etc."amazon/ssm/amazon-ssm-agent.json".source =  "${cfg.package}/etc/amazon/ssm/amazon-ssm-agent.json.template";
+
   };
 }