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:
{
"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.)
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 fakessh
executable produced
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 fakessh
executable - Setting
ACC_TEST_BUILDERS
to the builders to run the test on - Setting
ACC_TEST_PROVISIONERS
to includefakessh,shell
- Running
go test ./pkg/provisioner
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.
All other Go source files (files with extension .go
) in this repository are
licensed under the Mozilla Public License 2.0.
All Nix files (files with extension .nix
) in this repository are licensed
under the MIT License.