Commit Graph

29 Commits

Author SHA1 Message Date
Billie Cleek f5ca0de225 provisioner/ansible: assume scp target is file
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
2016-11-26 14:40:39 -08:00
Rickard von Essen a616c3da3c
provisioner/ansible: Move info messages to log
Make the ansible provisioner less noisy by moving most messages to the
log instead of ui print outs.

Closes #4117
2016-11-05 14:25:45 +01:00
Billie H. Cleek f760ab2fd8 Make SCP the default for provisioner/ansible
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.
2016-09-11 23:58:31 -07:00
Billie H. Cleek e6a0e523e2 refactor sftp subsystem request handling
Refactor the sftp subsystem request handling to make it more similar to
an exec request. This simplifies and improves the readability of the
code.
2016-09-11 23:58:31 -07:00
Billie H. Cleek da223b9539 add scp support to ansible provisioner
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.
2016-09-11 23:58:31 -07:00
Billie Cleek 023f2edde8 add better logging and error handling to ansible provisioner (#3477) 2016-08-24 19:53:39 +02:00
Ricard Clau 049fb2d9c1 actually check for errors in functional tests 2016-07-07 20:01:23 +01:00
Ricard Clau 0c81e49f83 Adding a functional test with an Ansible message very long 2016-07-07 01:12:57 +01:00
Chris Bednarski 664e640257 Merge pull request #3392 from msteinhoff/fix-ansible-provisioner-long-lines
Fix Scanner buffer too long error in ansible-remote provisioner
2016-07-06 15:27:57 -07:00
Billie Cleek 49067e732a append ANSIBLE_HOST_KEY_CHECKING correctly (#3568)
Append the ANSIBLE_HOST_KEY_CHECKING environment variable correctly
regardless of whether the template specifies some environment variables.
2016-05-24 15:34:51 -07:00
Mario Steinhoff b5f6e379f0 Fix Scanner buffer too long error in ansible-remote provisioner
Ansible may produce very long lines which Scanner can not handle. This
replaces the Scanner with a Reader and uses the ReadString method to
read an arbitrary large line from the ansible-playbook stdout pipe.
2016-03-28 21:27:42 +02:00
Rickard von Essen d59844f0d1 Determine current user without CGO. 2016-03-07 13:35:24 +01:00
Rickard von Essen 7369841e63 Ansible: add the support for specifying ansible_user
Closes #3273
2016-03-07 13:35:24 +01:00
Rickard von Essen d6716f6ee1 Ansible: don't use deprecated ssh options when ver above 2.0
Ansible 2.0 deprecated ansible_ssh_user, ansible_ssh_port, ansible_ssh_host
instead use ansible_user, ansible_port, and ansible_host in the
inventory file.

Closes #3275
2016-03-07 13:26:22 +01:00
Rickard von Essen f823725e53 Ansible: os.Environ() should always be passed to the ansible command.
Fixes GH-3271

Regression introduced in GH-3203
2016-02-26 20:49:37 +01:00
Vespian 4750da3457 Add empty_groups param to ansible provisioner 2016-02-19 23:46:50 +01:00
Marat Bakeev 2791542171 Allow specifying environment variables for ansible provisioner 2016-02-15 13:07:02 +13:00
Chris Bednarski 6dd02e7912 Update ansible test to use the new Downloader interface 2016-02-12 14:53:23 -08:00
Billie H. Cleek 0cd54ed19e add options to configure host alias and groups 2016-02-10 23:33:14 -08:00
Billie Cleek a5ab53bf5e update ansible tests
Update tests to account for changes made in #3149
2016-02-10 14:16:02 -08:00
Billie Cleek a23610ef41 cleanup ansible provisioner key generation
* 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.
2016-02-10 14:16:02 -08:00
Chris Bednarski 569e6cc464 go fmt 2016-02-08 17:34:06 -08:00
Marat Bakeev c95b2b483f Merge branch ansible-provisioner of https://github.com/dkhenry/packer 2016-02-05 15:40:17 +13:00
Billie H. Cleek bf3c294326 listen on system chosen port
Change the default for LocalPort to "0", so that the listener will be a
system chosen port.
2016-01-28 22:22:12 -08:00
Billie Cleek 77c48678d6 eliminate possible race conditions
Eliminate race-y use of the packer.Ui interface by wrapping it in a
concurrency-safe implementation.
2015-12-19 15:15:19 -08:00
Billie Cleek d73e75a7cf fix panic when connection is closed before packer send Shutdown 2015-12-19 12:15:04 -08:00
Billie Cleek 2dc9e0af3f fix `go vet` identified issues 2015-10-31 10:39:33 -07:00
Billie H. Cleek 5366393f9f fix tests 2015-10-31 10:39:33 -07:00
Billie H. Cleek cc8ca3098e add ansible provisioner 2015-10-31 10:39:33 -07:00