leocp1 / packer-provisioner-fakessh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fakessh Provisioner

Type: fakessh

The fakessh Packer provisioner is a modification of the shell-local provisioner that provides a fake ssh command that forwards its arguments to the Communicator. It's intended for use in commands like nix and git that use ssh to access remote servers.

This is a bit of a hack: consider using the Host, Port, User, Password, SSHPublicKey and SSHPrivateKey functions provided by the Template Engine instead. One main advantage of using a system ssh directly instead of this provisioner is support for gzip compression, which is currently unimplemented in the Go ssh library:

Basic Example

{
  "type": "fakessh",
  "inline": [
    "nix-copy-closure --to user@server /nix/store/hashofmynixossystemconfiguration-nixos-system-hostname-version"
  ]
}

nix-copy-closure internally calls ssh user@server "nix-daemon --stdio". The provisioner will change the PATH variable so that ssh points to a fake ssh command. The fake ssh command will ignore the destination and any command line flags and forward the "nix-daemon --stdio" command to the Packer Communicator. (fakessh doesn't support interactive ssh sessions.)

Configuration Reference

The configuration options are the same as the shell-local provisioner.

If the provisioner is reporting it can not find the ssh directory,

  • Run go build github.com/leocp1/packer-provisioner-fakessh/cmd/ssh
  • Set PACKER_FAKE_SSH_EXECUTABLE_PATH to the parent directory of the fake ssh executable produced

Acceptance test

Running the acceptance test requires

  • Copying or symlinking the build directory of the Packer repository to the root directory of this repository
  • Setting PACKER_FAKE_SSH_EXECUTABLE_PATH to the parent directory of the fake ssh executable
  • Setting ACC_TEST_BUILDERS to the builders to run the test on
  • Setting ACC_TEST_PROVISIONERS to include fakessh,shell
  • Running go test ./pkg/provisioner

See Also

Licenses

The file ./pkg/ctxio/ctxio.go in this repository contains an adaptation of functions published in "Cancelling I/O in Go Cap'n Proto" by Ross Light (link) which was licensed under the CC BY 4.0 License. License: CC BY 4.0

All other Go source files (files with extension .go) in this repository are licensed under the Mozilla Public License 2.0. License: MPL 2.0

All Nix files (files with extension .nix) in this repository are licensed under the MIT License. License: MIT

About


Languages

Language:Go 99.0%Language:Nix 1.0%