Commit Graph

21 Commits

Author SHA1 Message Date
Matthew Hooker 6f27f67346
more fixes from errcheck 2017-03-29 13:38:31 -07:00
Andrey Chernih 7548024720 More verbose error message when ansible-playbook fails
I've spent 1 hour today debugging why packer does not want to work with
ansible. It turns out `ansible-playbook` command was returning non-zero
exit status because of the file system permission problem.

Output before change:

    % packer build rabbitmq.json
    amazon-ebs output will be in this color.

    1 error(s) occurred:

    * exit status 1

Output after change:

    amazon-ebs output will be in this color.

    1 error(s) occurred:

    * Error running "ansible-playbook --version": exit status 1
2017-03-21 20:26:41 -07: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
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
Billie H. Cleek 0cd54ed19e add options to configure host alias and groups 2016-02-10 23:33:14 -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 2dc9e0af3f fix `go vet` identified issues 2015-10-31 10:39:33 -07:00
Billie H. Cleek cc8ca3098e add ansible provisioner 2015-10-31 10:39:33 -07:00