krebs / krops

Mirror of https://cgit.krebsco.de/krops/about/ (PRs / issues accepted, as can be seen by not having them disabled)
Do What The F*ck You Want To Public License
135 stars 18 forks source link

sudo on remote host [feature] #3

Closed ghost closed 4 years ago

ghost commented 4 years ago

I want to deploy to hosts where I don't have ssh access to the root user, but I have passwordless sudo. I have implemented a hard-coded version here: https://github.com/nyantec/krops/commit/b4d8f75d6a805796a5a9cbc2a43326682ca63371

4z3 commented 4 years ago

I think the main question is how to make this configurable. I'm not sure if we can sanely configure it via the target string, i.e. somewhere within "user@host:port/path", but we certainly could accept pre-parsed target arguments in writeDeploy & co.. Then sudo could be enabled like this:

pkgs.krops.writeDeploy "deploy" {
  source = /* ... */;
  target = lib.mkTarget "user@host/path" // {
    sudo = true; 
  };
}