mirror of
https://github.com/Smaug123/PulumiConfig
synced 2025-10-10 02:58:39 +00:00
Use Pulumi to provision and Nix to configure (#12)
This commit is contained in:
@@ -1,19 +1,12 @@
|
||||
namespace PulumiWebServer
|
||||
|
||||
open System.Diagnostics
|
||||
open Pulumi
|
||||
open Pulumi.Command.Local
|
||||
|
||||
[<RequireQualifiedAccess>]
|
||||
module Local =
|
||||
let forgetKey (address : Address) : unit =
|
||||
let address = address.Get ()
|
||||
let psi = ProcessStartInfo "/usr/bin/ssh-keygen"
|
||||
psi.Arguments <- $"-R {address}"
|
||||
psi.RedirectStandardError <- true
|
||||
psi.RedirectStandardOutput <- true
|
||||
psi.UseShellExecute <- false
|
||||
let proc = psi |> Process.Start
|
||||
proc.WaitForExit ()
|
||||
let error = proc.StandardOutput.ReadToEnd ()
|
||||
// We don't expect to have configured SSH yet, so this is fine.
|
||||
if proc.ExitCode <> 0 then
|
||||
failwith $"Unexpectedly failed to forget key: {address} ({proc.ExitCode}). {error}"
|
||||
let forgetKey (address : string) : Command =
|
||||
let args = CommandArgs ()
|
||||
args.Create <- Input.lift $"/usr/bin/ssh-keygen -R {address} || exit 0"
|
||||
|
||||
Command ($"forget-key-{address}", args)
|
||||
|
Reference in New Issue
Block a user