107 Commits

Author SHA1 Message Date
Gilles Cornu
8517014a99 provisioners/ansible: update inventory groups tests
With the introduction of inventory variables, group members provided as
String are not splitted (by ' ') into an array (instead of
auto-conversion to a single-item array).
2015-12-03 09:39:12 +01:00
Gilles Cornu
9867281971 provisioners/ansible: allow symbol in groups key
After c49a146467f7d7a0e441564a2418a1b8a42bb8a6, it makes even more sense
to support Symbol datatypes in `groups` option handling.
2015-12-03 09:34:53 +01:00
Gilles Cornu
3dbcf5083c provisioners/ansible(both) add more unit tests
Improve the test coverage of 'get_inventory_host_vars_string' method.
2015-12-02 08:42:44 +01:00
Gilles Cornu
c49a146467 provisioners/ansible(both): alias String-to-Symbol
String and Symbol types are different when used as a Hash key. By
default the Vagrant machine names are set in Symbol format, but users
may write their `host_vars` entries with String keys. This is a very
simple way to ensure smooth experience, without having to coerce the
data types during the config validation (e.g. with a library like
Hashie, which is currently not in the Vagrant dependencies)

See also:
- https://bugs.ruby-lang.org/issues/5964#note-17
- https://github.com/intridea/hashie#keyconversion
2015-12-02 08:37:41 +01:00
Christian Henz
a5dd61c450 Added test to expect host vars being inserted into inventory. 2015-12-01 18:56:28 +01:00
Christian Henz
3fbbfeb862 Expect group variables to be inserted in the test. 2015-12-01 18:56:28 +01:00
Gilles Cornu
eaf918ec35 Merge branch 'gildegoma/5086-ansible-winrm' into master 2015-11-25 22:46:08 +01:00
Seth Vargo
eaf0aeb210 Fix test 2015-11-23 19:35:03 -05:00
Seth Vargo
930e166b47 Add :env option to shell provisioner 2015-11-23 19:29:35 -05:00
Gilles Cornu
e4ff8ee398 provisioners/ansible: fix a typo in rspec example
[ci skip] good morning @gildegoma!!!
2015-11-23 09:12:56 +01:00
Gilles Cornu
ef66098472 provisioners/ansible: fix a typo in rspec example
[ci skip]
2015-11-23 09:10:28 +01:00
Gilles Cornu
de96b54272 provisioners/ansible: full test coverage of winrm
At the moment, the vagrant ssh username is used as default username when
force_remote_user option is disabled, even for winrm-communiating
machines. This could be improved in the future, but people hitting this
problem can easily work around it by syncing `config.ssh.unsername` and
`config.winrm.username` in their Vagrantfile.

ref #5086
2015-11-23 09:05:36 +01:00
Gilles Cornu
e2f0d2ebb7 provisioners/ansible: add a unit test for winrm
ref #5086
2015-11-22 20:48:21 +01:00
Gilles Cornu
2789ce61e0 Merge branch 'gildegoma/2718-ansible-galaxy' into master 2015-11-21 05:21:41 +01:00
Mitchell Hashimoto
e1f8b0d9c0 more passing tests on Windows 2015-11-20 15:24:51 -08:00
Mitchell Hashimoto
685f6d7e19 ansible tests passing on Windows 2015-11-20 15:13:35 -08:00
Seth Vargo
f5a0c3ed5b Deprecate docker.version 2015-11-19 18:37:57 -08:00
Seth Vargo
df207d2637 Require nodes_path for Chef Zero provisioning
Fixes GH-6110
2015-11-19 15:52:26 -08:00
Seth Vargo
c30467a6f9 Allow Chef to install on Windows 2015-11-19 15:01:09 -08:00
Seth Vargo
a90e6cfe4c Use the new Chef installation channel and options
This deprecates "prerelease", which will be removed in the next release.
2015-11-19 14:57:01 -08:00
Seth Vargo
b8f200a4c1 Only force the formatter if we are on Chef 11 or higher
Fixes GH-6278
2015-11-19 11:48:04 -08:00
Seth Vargo
9559fc549c Automatically generate a node_name for Chef
This is required because the Chef Server almost always needs a node name to
interact. This will default to the hostname, but that's always going to be
`vagrant.vm`, which will collide easily.

This generates a random hostname with `vagrant-` as the prefix and stores the
result in the machine's data directory.
2015-11-19 11:38:33 -08:00
Seth Vargo
a0c049da00 Fix tests 2015-11-18 18:32:46 -08:00
Seth Vargo
244069d5d7 Merge pull request #6049 from bdwyertech/bdwyertech-patch-2
Chef Zero - Fix 'nodes_path' Support
2015-11-18 16:46:02 -08:00
Mitchell Hashimoto
e6098f6c4f rename to powershell_elevated_interactive 2015-11-18 12:51:18 -08:00
Mitchell Hashimoto
37940e7350 Merge pull request #6185 from marc-ta/elevated_interactive
Elevated interactive
2015-11-18 12:46:39 -08:00
Mitchell Hashimoto
fedc7e21b3 provisioners/salt: deprecate config_dir 2015-11-18 11:56:07 -08:00
Gilles Cornu
c1f3d114f5 provisioners/ansible(both): add galaxy support
Close #2718
2015-11-17 22:08:29 +01:00
Gilles Cornu
b9738a8c4c provisioners/ansible: add missing unit test
Related to #5292
2015-11-17 22:08:18 +01:00
Gilles Cornu
a0576349fe provisioners/ansible(both): reorganize i18n texts
These adaptations will make even more sense with the upcoming
introduction of `ansible-galaxy` support.
2015-11-17 22:08:18 +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
Dan Dunckel
9d87be51da Small refactor on conditional check and add tests 2015-10-15 12:25:50 -07:00
Brian Dwyer
c23610d703 Update test 2015-09-27 23:24:01 -04:00
Sam Phippen
379dcfa568 Add a failing test for #6065 2015-09-12 14:31:49 +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
Brian Dwyer
15ec95328a Update test 2015-07-28 13:24:39 -04: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
76651a413d provisioners/ansible: Update unit tests
Signed-off-by: Luis Pabón <lpabon@redhat.com>
2015-07-10 08:51:17 +02:00
Seth Vargo
d72306b6d5 Fix command builder tests 2015-07-09 21:36:50 -06:00
Seth Vargo
06dcd55f57 Fix tests 2015-07-09 16:59:17 -06:00
Gilles Cornu
839a2e6fa6 provisioners/ansible: show ansible-playbook only when the verbose option is enabled
Revert 1c884fa4e5a847549afa45350e37b0362c50feae 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
Mitchell Hashimoto
2fc8d99f6d provisioners/file: validate source relative to Vagrantfile path
[GH-5252]
2015-07-06 14:22:00 -06:00
Gilles Cornu
272fb27e05 provisioners/ansible: trim white spaces
[ci skip]
2015-06-01 10:12:22 +02:00
Gilles Cornu
f7894d9c8c provisioners/ansible: fix broken colorized output
After #5532 (e745436df3c64537570953d4d815eaec840da46d), 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
Mario Rodas
e745436df3 provisioners/ansible: disable color if Vagrant has no color [GH-5531] 2015-03-28 19:05:54 -05:00
Michael Lopez
6ba6c7c1c3 Update unit tests for chef_zero provisioner 2015-02-14 22:33:23 +01:00
Gilles Cornu
2ecad8bb93 provisioners/ansible: increase connection timeout
This change helps to avoid troubles like reported in #5018 and #4860.

Note that for sake of configuration simplicity, no new `ansible.timeout`
option has been added. The users who want to set a different value can
rely on `ansible.raw_arguments`.
2015-01-12 10:54:01 +01:00