27 Commits

Author SHA1 Message Date
Megan Marsh
b66e49223d extract the building of command args into a testable helper function 2020-04-01 16:07:14 -07:00
Megan Marsh
73c87044fd fix tests 2020-04-01 11:31:48 -07:00
Megan Marsh
eda9ce70e7 update tests 2020-04-01 11:31:48 -07:00
Megan Marsh
9a40403433 clean up tests 2020-04-01 11:31:48 -07:00
Megan Marsh
6c756a7b31 fix tests 2020-04-01 11:31:48 -07:00
Megan Marsh
ca5814ab74 move proxy behind feature flag 2020-04-01 11:31:48 -07:00
Megan Marsh
39fd462b56 change all provision func signatures to use map[string]interface{} 2019-12-12 15:38:32 -08:00
Megan Marsh
0ca7c9f397 fix tests 2019-12-11 16:29:35 -08:00
Adrien Delorme
c7ce4d598e change Provisioner to be passed a context for cancellation 2019-04-03 15:55:54 +02:00
Adrien Delorme
5a6dffde9a use port as ints 2019-03-19 15:01:12 +01:00
Rickard von Essen
52b55fb899
ansible: change local_port to uint instead of string 2019-02-04 18:47:42 +01:00
Adrien Delorme
7c63c322c7 make provisioner/ansible/provisioner_test.go invisible to windows 2018-10-16 18:40:07 +02:00
Megan Marsh
a0edaf6c46 Going to revert this change for now, becuase of potential issues that arise from calling Prepare() twice
Revert "use statebag instead of SetSharedState for winRM password"

This reverts commit b35acbd8798a1baa645f0d181731a9cd9318a61c.
2018-09-10 16:48:42 -07:00
Megan Marsh
b35acbd879 use statebag instead of SetSharedState for winRM password 2018-08-24 13:51:16 -07:00
Aidan Feldman
b894c925d1
make user retrieval for Ansible provisioner more robust
Previously, the Ansible provisioner would look for the username from the
`USER` environment variable. Unfortunately, this is not always set -
particularly in Docker containers. It's very confusing to understand why
the error is happening.

Switched to using Go's built-in `os/user` package for retrieving the
current username. @rickard-von-essen had done this in 7369841, but
moved away from it in d59844f because, at the time, it wasn't possible
to use that library with cross-compilation. This was fixed in Go in

795e712b72
2018-01-03 02:52:41 -05:00
Dan Fuchs
97c819dc15 Merge branch 'master' of https://github.com/mitchellh/packer into ansible-inventory-dir 2017-04-20 10:34:03 -05:00
Dan Fuchs
3fc809c05b Ansible provisioner: check if inventory directory exists during prepare 2017-04-04 22:49:24 -05:00
Dan Fuchs
492bff474b Ansible provisioner: Specify full path to generated inventory file 2017-04-04 22:04:26 -05:00
Dan Fuchs
609e70face inventory_directory option for ansible provisioner
Add an `inventory_directory` setting to the Ansible provisioner that
allows a user to specify a directory in which the Packer Ansible
provisioner would write the generated inventory file.  If a value is
specified for this setting, then have the Packer Ansible provisioner
pass this directory as the -i arg when it calls ansible.

This would allow an Ansible playbook used by the Packer Ansible
provisioner to use variables specified in `host_vars` and `group_vars`
in this inventory directory.
2017-04-04 16:43:46 -05:00
Matthew Hooker
81522dced0
move packer to hashicorp 2017-04-04 13:39:01 -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
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
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
Billie Cleek
a5ab53bf5e update ansible tests
Update tests to account for changes made in #3149
2016-02-10 14:16:02 -08: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