Commit Graph

51 Commits

Author SHA1 Message Date
Megan Marsh fa6eb3fdea reverts 406bf9c4aad7c925c3f5a837fe7f9c71169af098; this was incorrect interpretation of the intent of the inventoryDirectory template option 2018-12-03 16:08:47 -08:00
Megan Marsh 3f8407d95f Revert "Merge pull request #6700 from hashicorp/multi_progressbar"
This reverts commit 5470c08345, reversing
changes made to c427486bca.
2018-09-20 13:14:17 -07:00
Adrien Delorme dfeca9f0df split progressbars per object 2018-09-12 16:21:58 -07: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 b35acbd879.
2018-09-10 16:48:42 -07:00
Adrien Delorme 9b07d7670e use no ops for ansible ui & MachineReadableUi 2018-09-06 15:53:59 +02:00
Adrien Delorme ddd96c513b first draft at self refreshing loading bar centralized/controlled by Ui 2018-09-06 15:53:59 +02:00
Megan Marsh b35acbd879 use statebag instead of SetSharedState for winRM password 2018-08-24 13:51:16 -07:00
Megan Marsh ff6a039d5b replace scrubconfig with packer.LogSecretFilter.Set
filter winrm password from logs
Add new root-level packer template option, sensitive-variables, to tell us what user variables to mark sensitive.
2018-08-20 15:35:55 -07:00
Megan Marsh a5a6b1ab58
Merge pull request #6501 from Wenzel/expose_ansible_packer_http_addr
Expose ansible packer_http_addr extra var
2018-07-18 17:18:46 -07:00
Megan Marsh e146973d08 change implementation to set winrm password in way that matches powershell and shell-local implementations; sanitize logs 2018-07-17 16:39:50 -07:00
Mathieu Tarral 3450b6fd6f ansible: expose packer_http_addr extra var 2018-07-17 19:58:07 +03:00
Levi 6646d42490 updated function calls to include buildname and changed variable names 2018-07-14 14:39:38 -04:00
Levi 68ec630fde added function to retreive winrm password from commonhelper 2018-07-14 11:25:04 -04:00
Levi 636cec8f2b added commonhelper import 2018-07-14 11:25:01 -04:00
Levi 37fd50995f added parameter for setting packer password as env variable 2018-07-14 11:25:00 -04:00
Omer Katz c0719a3590
Allow using a custom inventory file. 2018-04-05 12:56:07 +03:00
Joshua C. Randall 406bf9c4aa override ansible executor inventory to use InventoryDirectory instead of InventoryFile when set 2018-03-26 17:24:58 +01:00
Marc Mercer d3c7d43f20
Small typo correction 2018-02-07 19:47:01 -08:00
Marc Mercer 5d67f77f43
Fixing 5852 2018-02-07 19:41:01 -08: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
Matthew Hooker 8f685b3bcd
ansible: add skip_version_check flag 2017-06-07 13:31:56 -07:00
Dan Fuchs 8401057ed5 Merge branch 'master' into ansible-inventory-dir 2017-04-26 13:20:00 -05:00
Rickard von Essen 999f2da499
ansible-local/ansible: Add extra-vars packer_*
Added:
- `packer_build_name`
- `packer_builder_type`
- `packer_http_addr` - `ansible-local` only

Closes: #4820
2017-04-23 12:55:01 +02: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 f45f4568db make validateInventoryDirectoryConfig function 2017-04-06 14:50:02 -05:00
Dan Fuchs 39a9eac44f Remove `req` param from validateDirectoryConfig 2017-04-05 09:14:30 -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
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