Commit Graph

557 Commits

Author SHA1 Message Date
Gilles Cornu 75cc6ef8d3 provisioners/ansible_local: fix a str-to-sym bug
Without this change `ansible.version = "latest"` is not considered as
equivalent to `ansible.version = :latest`.
2015-11-12 09:14:35 +01:00
Gilles Cornu a3c077cbe0 Merge branch 'gildegoma/ansible-force-ssh-user'
Resolved conflicts in
  plugins/provisioners/ansible/config.rb
  plugins/provisioners/ansible/provisioner.rb
  test/unit/plugins/provisioners/ansible/provisioner_test.rb
  website/docs/source/v2/provisioning/ansible.html.md

ref #6348
2015-11-08 14:01:23 +01:00
Gilles Cornu 9bfdaf7e75 provisioners/ansible: introduce ansible_local
With this change, the existing host-based Ansible provisioner is
refactored to share a maximum of code with this new guest-based Ansible
provisioner.

At this stage of development, the existing unit tests are intentionally
modified as little as possible, to keep safe the existing funtionalities.

Other issues resolved by this changeset:
 - Display a warning when running from a Windows host [GH-5292]
 - Do not run `ansible-playbook` in verbose mode when the `verbose` option
   is set to an empty string.
2015-11-08 10:42:48 +01:00
Gilles Cornu dde94a3ce7 provisioners/ansible: add force_remote_user option
The benefits of the following "breaking change" are the following:
- default behaviour naturally fits with most common usage (i.e. always
  connect with Vagrant SSH settings)
- the autogenerated inventory is more consistent by providing both the
  SSH username and private key.
- no longer needed to explain how to override Ansible `remote_user` parameters

Important: With the `force_remote_user` option, people still can fall
back to the former behavior (prior to Vagrant 1.8.0), which means that
Vagrant integration capabilities are still quite open and flexible.
2015-11-02 09:03:15 +01:00
Sam Phippen 53714abfa3 Handle encoding errors in shell provisioner newline normalization.
The problem demonstrated in #6065 is that a string has incorrectly been
encoded with US-ASCII even though it contains invalid US-ASCII byte
sequences (any byte with the most significant bit on is invalid in the
US-ASCII encoding).

The thing about doing newline normalization is that it is not actually
sensitive to the presence of US-ASCII byte sequenzes. Additionally, it
is very unlikely that a user will ever be using an encoding where \r\n
is not encoded the same as it would be in ASCII.

This patch first tries the existing method of normalizing the newlines
in the provided script file, if that fails for any reason it force
encodes the string to ASCII-8BIT (which allows the most significant bit
to be on in any individual byte) and then performs the substitution in
that byte space.
2015-09-12 14:36:54 +01:00
konomae ad9a7324c5 Fix invalid ini entry error when ansible_ssh_private_key_file contains spaces 2015-08-29 18:00:20 +09:00
Jason Woods ff941ef4e8 Fix broken masterless minion configuration 2015-08-03 12:11:32 +01:00
지훈 287831dd2e Fix for Issue #6006 - cfengine will now install 2015-07-20 02:08:13 -07:00
Mitchell Hashimoto 4b217e2128 Merge pull request #5980 from PatOShea/PatOShea-ConfigDir-Typo
Fixed salt minion configuration directory typo
2015-07-17 12:37:44 -07:00
Pat O'Shea a4eede0c42 fixed typo for config_dir
Only exposed when calling highstate with config_dir being set
2015-07-16 18:45:59 -06:00
Pat O'Shea 956bbf011c Changed minion config path for windows
Copy of minion is wrong on windows. Moved to sub-dir, conf.
2015-07-16 18:37:36 -06:00
Mitchell Hashimoto ce5a30b264 provisioners/puppet: fix config merging [GH-5958] 2015-07-15 10:59:34 -07:00
Mitchell Hashimoto 3476491881 update CHANGELOG 2015-07-15 10:57:38 -07:00
Ben Hines 46eedb6491 Back to using 'which' when no path is defined since the winrm communicator overrides it anyway. 2015-07-14 23:55:09 -07:00
Ben Hines 8c2ddac2cd Check for nil config_path. 2015-07-14 23:26:55 -07:00
Ben Hines 8c1ff5ee26 Fix custom puppet.binary_path to work properly on windows.
Fix automatic puppet path detection on windows
2015-07-14 23:21:46 -07:00
William Kral 27d7518636 Fix alignment of initializer 2015-07-11 10:40:17 -07:00
William Kral ccd7354665 Initialize the install_command salt config var 2015-07-11 10:31:19 -07:00
Seth Vargo 516d475f16 Checksum args to each docker container in local data
This allows Vagrant to calculate if a container's arguments (such as the run
arguments) have changed in the Vagrantfile since the original run.

Fixes GH-3055
2015-07-10 11:32:02 -06:00
Seth Vargo 3e3037f313 Add a space before args 2015-07-10 10:49:21 -06:00
Gilles Cornu 3842a1f710 provisioners/ansible: provide ssh identities via ANSIBLE_SSH_ARGS (when necessary)
When provisioning multiple machines in sequence (the default vagrant
behaviour), it doesn't make sense to require to provide the private ssh
key(s) via the custom ansible inventory script/file.

To align with the handling of multiple ssh keys per machine, we won't
rely any longer on `--private-key` command line argument, but only pass
the keys via `ANSIBLE_SSH_ARGS` environment variable.

Note that when vagrant generates the ansible inventory and that only one
key is associated to a VM, this step would be redundant, and therefore
won't be applied.

This change fixes the breaking change introduced by 3d62a91.
2015-07-10 08:51:17 +02:00
Luis Pabón f0718d620d provisioners/ansible: Put ssh key in the inventory
Vagrant 1.7.1 creates and injects new ssh keys for each virtual machine.
When it started ansible with the "parallel provisioning trick",
it would only send the ssh key of the targeted virtual machine.
With this change, vagrant now stores the ssh key for each virtual
machines directly in the generated ansible inventory, and thus allow
ansible parallelism.

Note that this change is not sufficient, as it would break vagrant
configuration based on a custom inventory (file or script). This issue
will be addressed in a next commit.

Signed-off-by: Luis Pabón <lpabon@redhat.com>
2015-07-10 08:39:49 +02:00
Seth Vargo 4b1847acf3 Use Chef Client for Chef Zero
Fixes GH-5619
2015-07-09 21:23:42 -06:00
Seth Vargo 40b94afeb5 Update command builder now that provisioning_path has moved to runtime 2015-07-09 17:46:39 -06:00
Seth Vargo 60330218fb Merge pull request #5913 from mitchellh/sethvargo/windows_chef_paths
Use windows-specific Chef paths
2015-07-09 17:05:40 -06:00
Seth Vargo e9bcf147f0 Prefix with guest_ 2015-07-09 17:01:36 -06:00
Seth Vargo 0e039159a6 Calculate Chef paths at provision time 2015-07-09 16:55:55 -06:00
Nicholas Randon eb6aa2ac8c Allow Ansible provisioner to run reliably in parallel
The Ansible Vagrant provisioner has a race where the inventory file is
updated every time the provisioner runs unless a file is provided.

Therefore if Ansible attempts to provision two nodes in parallel, you
may see the following race:
   * System A writes the inventory file and calls Ansible.
   * System B starts to provision and truncates the file before
     creating a new one.
   * Ansible on system A now attempts to read the inventory
     file, which is blank. Ansible bombs out with "ERROR: provided
     hosts list is empty".

To fix this, we only allow Vagrant to update the inventory file if
it needs to.
2015-07-10 00:53:59 +02:00
Seth Vargo 742d47c4cf No longer need subprocess wrapping there :) 2015-07-09 16:06:03 -06:00
Mitchell Hashimoto d51c5fbc69 Merge pull request #5435 from juiceinc/bugfix/salt-provisioner
Update Salt provisioner to allow more flexibility in passing arguments to the bootstrap script
2015-07-09 15:02:34 -06:00
Mitchell Hashimoto 300b9c9109 provisioners/chef: don't check existing set, unique ID
[GH-5199]
2015-07-09 14:04:12 -06:00
Mitchell Hashimoto 9dd5640324 provisioners/docker: for debian, chmod the var lib docker folder 2015-07-08 12:13:25 -06:00
Gilles Cornu 839a2e6fa6 provisioners/ansible: show ansible-playbook only when the verbose option is enabled
Revert 1c884fa4e5 which introduced the
following bug:

Instead of allowing to dump the `ansible-playbook` command details when
VAGRANT_LOG=debug was defined, it was then impossible to disable this
console output when VAGRANT_LOG was undefined (in such case,
``@logger.debug? systematically returns `true`)

In order to keep things simple and focused, it is preferable to drop the
bad idea to mix Ansible verbosity and Vagrant log level.

Fix #5803
2015-07-07 22:37:06 +02:00
Mitchell Hashimoto 9c7f666e48 provisioners/docker: support restart flag [GH-4477] 2015-07-07 12:17:24 -06:00
Pat O'Shea da67824a53 Adding run_service and minion/master ids for windows 2015-07-07 00:24:23 -06:00
Mitchell Hashimoto 4d2e8fd591 Merge pull request #5860 from arthurvanduynhoven/docker-provisioner-deb-fix
provisioner/docker: Docker Provisioner fails on Debian [ubuntu/trusty64]
2015-07-06 15:16:03 -06:00
Mitchell Hashimoto cc2d393611 Merge pull request #5892 from PatOShea/master
provisioner/salt: Updated version for windows and added passing in version via vagrantfile
2015-07-06 15:11:08 -06:00
Mitchell Hashimoto 2fc8d99f6d provisioners/file: validate source relative to Vagrantfile path
[GH-5252]
2015-07-06 14:22:00 -06:00
Jeff Quast 1ac3d17773 bugfix: undefined local variable or method `dir'
resolves bug introduced in 74d22069d4
2015-07-06 11:39:07 -07:00
Mitchell Hashimoto fec6ef11c8 provisioners/puppet: just quiet the NFS errors for Puppet [GH-5456] 2015-07-06 11:19:32 -06:00
Mitchell Hashimoto e64cef9d31 provisioners/chef: fix crash if run list is somehow nil [GH-5545] 2015-07-05 17:30:29 -07:00
Pat O'Shea eab702da83 Adding config to set version to install 2015-07-04 01:25:31 -06:00
arthurvanduynhoven 94549ab755 Need to do update before installing linux-image-extra kernel in case system is outdated. 2015-06-24 14:56:28 +02:00
Seth Vargo b92d4b21a1 Add UI::Interface#color? 2015-06-01 11:49:09 -04:00
Tim O'Guin 72e63767ac Salt Provisioner: refactor custom install_type option to add install_command instead 2015-06-01 10:37:41 -05:00
Tim O'Guin 0b24866537 merged in master and resolved conflict in Salt provisioner docs 2015-06-01 10:07:28 -05:00
Gilles Cornu f7894d9c8c provisioners/ansible: fix broken colorized output
After #5532 (e745436df3), it was no longer
possible to enable ansible colorized output. Even though
`ANSIBLE_NOCOLOR` has no effect *at the moment* in vagrant+ansible
integration, I agree to keep it for clarity and consistence.

The new `--no-color` behaviour (bug fix #5531) is now covered by a unit
test.

//cc @marsam, @sethvargo
2015-06-01 08:36:09 +02:00
Seth Vargo 3017243a24 Merge pull request #5577 from luciddg/fix/master/docker-provisioner-restart-fix
Use service command to restart docker, not upstart.
2015-05-31 20:44:48 -07:00
Seth Vargo 6a48af6350 Merge pull request #5532 from marsam/fix/master/ansible-no-color
Disable color if in ansible provisioner if Vagrant has no color
2015-05-31 20:34:06 -07:00
Seth Vargo f5c77765fa Merge pull request #5437 from Jamezz/master
Fix issue #4152: Salt minion bootstrapping
2015-05-31 20:08:32 -07:00