Assume the scp target is a file instead of a directory. Assuming the scp
target is a file instead of a directory allows uploading files to a node
being provisioned with the ssh communciator using sftp and with the
winrm communicator. It is fully compatible with ansible; ansible
communicators only allow for files (never directories) to be uploaded
(when the copy module is used to upload a directory, ansible walks the
directory and uploads files one at a time).
Update documentation to explain how to provision a Windows image.
Extend tests that use ssh to communicate with the node to include single
files, recursive copies, and content-only recursive copies.
Add test to verify support for the winrm communicator.
Remove the err argument from adapter.scpExec, because it was unused.
Fixes#3911
In the "Execute Command Example - Sudo Example", the used command is
defining environment variables prematurely, hence requiring the sudo
invocation to be made with the `-E` flag. However, this is not only
necessary but might have indesirable side effects, as the `-E` flag
forwards the whole environment to the subshell.
Add a new option, `use_sftp` to the ansible provisioner. It's default
value is false; ansible provisioner will use SCP by default.
Refactor to consistently set all configure options for ansible
provisioner in the Prepare step.
Remove incorrect information about `ANSIBLE_HOST_KEY_CHECKING=False`
being set when `ansible_env_vars` is not set in the packer template.
Update BATS tests for the ansible provisioner to actually check that the
fetched directory contains the contents expected. This revealed a
problem with the all_options template that required adding a host to the
hosts list in the test playbook.
Handle running `scp -t` and `scp -f` exec requests in the
ansible-provisioner's SSH
server to allow Ansible to use SCP so that SFTP doesn't have to be
installed on the node.
Update the BATS tests to test the ansible provisioner.
Commonly /tmp is set as noexec, as a result packer scripts
fail to run. In order to get around this one can set a
remote_path, whoever, remote path requires full filename
and path.
By making remote_path a combination of
remote_folder/remote_script we can change remote_folder
and keep the default script_nnn.sh
Signed-off-by: Ian Duffy <ian@ianduffy.ie>
* Add text explaining the basics of how the ansible provisioner works.
* Refactor the basic example to demonstrate the simplest case.
* Use active voice more consistently.
* Clearly separate host signer and user key generation into separate
functions and data structures.
* Remove inaccurate comment about needing to specify both files if
either one is specified.
* Rename parameters for clarity according to their meaning to the
callee.
* Style the code with gofmt.