Commit Graph

1856 Commits

Author SHA1 Message Date
Gilles Cornu f96636587a provisioners/ansible: don't read/write known_hosts
Like Vagrant's default SSH behaviors (e.g ssh or ssh-config commands),
the Ansible provisioner should by default not modify or read the user
known host file (e.g. ~/.ssh/known_hosts).

Given that `UserKnownHostsFile=/dev/null` SSH option is usually combined
with `StrictHostKeyChecking=no`, it seems quite reasonable to bind the
activation/disactivation of both options to `host_key_checking`
provisioner attribute.

For the records, a discussion held in Ansible-Development mailing list
clearly confirmed that there is no short-term plan to adapt Ansible to
offer an extra option or change the behavior of
ANSIBLE_HOST_KEY_CHECKING. For this reason, the current implementation
seems reasonable and should be stable on the long run.

Close #3900

Related References:

- https://groups.google.com/forum/#!msg/ansible-devel/iuoZs1oImNs/6xrj5oa1CmoJ
- https://github.com/ansible/ansible/issues/9442
2014-11-30 09:55:48 +01:00
Gilles Cornu 178942cf27 provisioners/ansible: change arguments arrangement
- force `--connection=ssh` (any other modes like paramiko or smart are not
  supported)
- give the highest priority to `raw_arguments` for sake of simplicity (in
  usage, in code and in documentation)
- fix position of the `--limit` argument (the generated inventory could be
  shadowed by `raw_arguments`, while ansible.limit was able to override
  `raw_arguments`

ref #3396
2014-11-30 09:50:50 +01:00
Gilles Cornu 306c4f7eda provisioners/ansible: force --connection=ssh
When `--connection` argument is not specified, Ansible will use the
'smart' mode, which can either use `ssh` or `paramiko` transports,
depending of the version of OpenSSH available. If OpenSSH version is new
enough to support ControlPersist technology, `ssh` will be used.
See also http://docs.ansible.com/intro_configuration.html#transport.

In order to support some advanced features of Vagrant (e.g. multiple ssh
private key identities or ssh forwarding), the Ansible provisioner
already must force `ssh` connection mode.

Having to deal with the possible fallback to `paramiko` increase the
burden of special cases that Ansible provisioner must handle, without
any added value, as Vagrant is based on OpenSSH and its users are
usually using modern operating systems.

With this change, the Ansible provisioner will officially only support
`ssh`. It will still be possible to switch to another connection mode
via `raw_arguments`, but it will breach the "contract", and no
(community) support can be expected in such use case.

ref #3900, #3396
2014-11-30 09:50:50 +01:00
Gilles Cornu 1c884fa4e5 provisioners/ansible: Show Ansible command when VAGRANT_LOG=debug 2014-11-25 08:12:43 +01:00
Mitchell Hashimoto f8a2322459 core: only delete state if not created on initialize only
/cc @sethvargo
2014-11-10 16:29:19 -08:00
Seth Vargo 5b1211fc63 Merge pull request #4792 from mwrock/state_refresh_fix
fixes infinite loop in machine state call if provider calls machine.action
2014-11-10 12:24:24 -05:00
Seth Vargo f232dc38c9 Automatically install Chef when provisioning with Chef 2014-11-07 15:56:22 -05:00
Seth Vargo b7c03ddbe2 Update config tests to reflect new structure 2014-11-07 15:56:21 -05:00
Matt Wrock dc628cd722 fixes infinite loop in machine state call if provider calls machine.action 2014-11-06 08:51:47 -08:00
Seth Vargo 1464a63928 Merge pull request #4777 from voxik/remove-useless-expect-with
Remove useless expect_with
2014-11-04 09:29:29 -05:00
Vít Ondruch dff40a193d Remove useless expect_with.
This seems to be relict of old days and it just forces unnecessary
dependency on Ruby's test unit.
2014-11-04 10:01:32 +01:00
Seth Vargo 59eb0ad2e8 Add Chef Apply provisioner 2014-10-30 15:32:15 -04:00
Seth Vargo 3b416db299 Tabs -> Spaces 2014-10-30 13:43:26 -04:00
Seth Vargo f5b9044e39 Add tests for Chef Zero config 2014-10-30 13:43:26 -04:00
Seth Vargo a8a35757ee Add tests for Chef Solo config 2014-10-30 13:43:26 -04:00
Seth Vargo 9c56061fa9 Add tests for Chef Client config 2014-10-30 13:43:25 -04:00
Seth Vargo 8b3ec500c8 Remove :focus tag (accidentally left from previous commit) 2014-10-30 13:43:25 -04:00
Seth Vargo f009db6101 Add tests for Chef base Config 2014-10-30 13:43:25 -04:00
Mitchell Hashimoto f4dec575ed core: Vagrant::Util::Keypair for generating keypairs 2014-10-24 09:33:44 -07:00
Mitchell Hashimoto 97f9948fce core: provisioners are defined differently now 2014-10-23 18:40:14 -07:00
Mitchell Hashimoto 13dc1832b6 test: fix test for default provider 2014-10-23 16:41:24 -07:00
Mitchell Hashimoto b7478e09f3 core: clean up default logic 2014-10-23 15:59:27 -07:00
Mitchell Hashimoto 768d453739 core: Environment#default_provider can look into machines 2014-10-23 15:52:42 -07:00
Mitchell Hashimoto ad758bf69a core: prefer providers in the Vagrantfile [GH-3812] 2014-10-23 15:32:54 -07:00
Mitchell Hashimoto f0a73c7c05 core: call #state in any #action call [GH-4513] 2014-10-23 12:20:16 -07:00
Mitchell Hashimoto 4827469dee core: recognize more complex content types for json [GH-4525] 2014-10-23 11:26:56 -07:00
Mitchell Hashimoto 2856df79ac core: Vagrant.has_plugin? can take version requirements [GH-4650] 2014-10-23 10:52:02 -07:00
Mitchell Hashimoto f122ed756c Merge pull request #4571 from jperville/docker-provider-allow-multiple-links-to-same-backend
providers/docker: allow multiple links to same backend (different aliases)
2014-10-23 09:45:14 -07:00
Mitchell Hashimoto 5036d16461 update CHANGELOG 2014-10-23 09:15:47 -07:00
Mitchell Hashimoto 381f1332c8 Merge pull request #4670 from gildegoma/dry-check-ssh-perms
Check SSH key permissions in machine.ssh_info
2014-10-23 09:14:31 -07:00
Mitchell Hashimoto 7287604450 Merge pull request #4671 from jramnani/fix/master/nfs_exports_file_for_freebsd_guests
Fix #4658. Bad NFS exports file on OS X & BSD hosts.
2014-10-23 09:12:00 -07:00
Mitchell Hashimoto 296d0639cc providers/docker: support auth [GH-4042] 2014-10-22 13:12:31 -07:00
Mitchell Hashimoto cff57c8d01 core: trigger machine_id_changed for reload [GH-3963] 2014-10-22 12:07:49 -07:00
Mitchell Hashimoto 7988f0fb7c Fix broken unit tests 2014-10-22 09:44:48 -07:00
Mitchell Hashimoto 82f806f438 Fix unit tests 2014-10-22 08:39:59 -07:00
Mitchell Hashimoto 9d4ab18f42 providers/docker: stop_timeout [GH-4504] 2014-10-21 17:50:45 -07:00
Jeff Ramnani bd5fd7ab18 Fix #4658. Bad NFS exports file on OS X & BSD hosts.
For FreeBSD guests, Virtualbox can sometimes report the private network
interface IP address as "0.0.0.0".  This will cause an invalid NFS
exports file to be generated for FreeBSD and OS X hosts.

Fixed by not allowing Virtualbox to report a guest IP address of
"0.0.0.0".
2014-10-20 12:35:30 -05:00
Gilles Cornu 89a4a29d65 Memoize machine.ssh_info when ready for connection 2014-10-20 17:45:02 +02:00
Gilles Cornu 4e81be879c Check SSH key permissions in machine.ssh_info
With this change, any caller of machine.ssh_info is assured that best
efforts will be done to fix possible wrong permissions on the private
key files.

Fix #4652
2014-10-20 17:33:06 +02:00
Shawn Neal 220e4f23b2 Merge pull request #4209 from mwrock/smb_sync
adding smb sync folder implementation for windows guests addressing #3699
2014-10-07 08:19:26 -07:00
Julien Pervillé 97341c3234 providers/docker: allow multiple links to same backend (different aliases). 2014-09-29 18:46:01 +02:00
Mitchell Hashimoto 8655d212c3 kernel/v2: always forward SSH [GH-4437] 2014-09-04 14:19:47 -07:00
Mitchell Hashimoto 09d2b6fd86 core: add Checkpoint 2014-09-01 15:06:51 -07:00
Mitchell Hashimoto 41f4ec1e4d guests/redhat: set hostname on EL7 [GH-4352] 2014-08-31 09:58:12 -07:00
Mitchell Hashimoto 083dce5c61 Revert "core: guard against SSH to localhost:22 [GH-4070]"
This reverts commit 62561f2844.

This broke WinRM. Will fix in a future version.
2014-08-30 22:55:13 -07:00
Eric Saxby dd77295533 Ensure rsync_post has find permissions on smartos 2014-08-29 14:17:28 -07:00
Mitchell Hashimoto a6163d4062 Fix failing test 2014-08-29 11:26:09 -07:00
Leo Simons fec14cf04c Use -f argument to rm to force-remove files.
When using pty=true, removing files using sudo may request confirmation,
which will hang the connection.

Similarly, sometimes assumptions about file existence may be wrong and
in those cases it seems better to continue on as long as the file does
not exist, so -f makes sense there, too.
2014-08-29 10:51:31 +02:00
Veres Lajos 4ef996dca9 typofixes - https://github.com/vlajos/misspell_fixer 2014-08-25 20:12:25 +01:00
Mitchell Hashimoto a53156e426 core: don't allow '/' in VM name [GH-4289] 2014-08-11 09:21:31 -07:00
Matt Wrock e64f84491e adding smb sync folder implementation for windows guests addressing #3699 2014-08-11 00:07:21 -07:00
Mitchell Hashimoto b675be383b core: disallow brackets in VM names [GH-4319] 2014-08-10 21:05:29 -07:00
Mitchell Hashimoto e198652e75 core: don't load curlrc [GH-4328] 2014-08-10 20:49:53 -07:00
Mitchell Hashimoto 15f1823d5c core: box names with colons work on Windows [GH-4100] 2014-08-08 14:47:17 -07:00
Mitchell Hashimoto 27bf597214 Add box collection test for colons 2014-08-08 14:35:05 -07:00
Mitchell Hashimoto 62561f2844 core: guard against SSH to localhost:22 [GH-4070] 2014-08-08 11:58:53 -07:00
Mitchell Hashimoto a08d9078da commands/rsync-auto: check machine ID prior to sync [GH-4031] 2014-08-06 16:56:09 -07:00
Mitchell Hashimoto 7f5f720e0a core: Machine#reload 2014-08-06 16:46:31 -07:00
Mitchell Hashimoto 94841ef1bc Merge pull request #4094 from mitchellh/improved-winrm-command-failure-messaging
provisioners/winrm: Better WinRM command failure messaging
2014-08-06 10:44:35 -07:00
Mitchell Hashimoto 2cdcc29902 provisioners/chef: put global lock around knife exec 2014-08-06 10:24:05 -07:00
Mitchell Hashimoto f5854c5618 Merge pull request #4234 from b-dean/fixnum-array-args-fix
provisioner/shell: fix cannot handle Fixnum array args
2014-08-05 17:29:59 -07:00
Mitchell Hashimoto 7aff08f9a1 Merge pull request #4271 from Scythril/winrm_mkdir_rm_filter
communicator/winrm: Fixed some WinRM command filters
2014-08-05 17:22:24 -07:00
Mitchell Hashimoto bd94fbd9ba Merge pull request #4274 from sax/smartos_rsync
guests/smartos: rsync on SmartOS should use pfexec
2014-08-05 17:20:38 -07:00
Franz Pletz 6def193567 Add config.vm.box_server_url setting
This commits adds a new config setting `config.vm.box_server_url` to set
the URL of a local VagrantCloud instance in the Vagrantfile. If the
environment variable `VAGRANT_SERVER_URL` is set, it will still be
preferred.
2014-08-01 14:38:55 +02:00
Eric Saxby 0cb7ec2d52 rsync on SmartOS should use pfexec 2014-07-31 14:41:06 -07:00
Richard Guin 08732f5a39 Added/updated unit tests for WinRM mkdir/rm command filters 2014-07-31 14:42:11 -04:00
Ben Dean 7dc0e4340e adding failing tests for fixnum args in an array.
The args need to be strings so that an error won't happen with `text.gsub` in bb052366f7/plugins/provisioners/shell/provisioner.rb (L122)

See my comments on mitchellh/vagrant#2982 as to why it needs to test for this.
2014-07-22 15:41:01 -04:00
Shawn Neal 911406ed4a Addressed issues with Windows guest renaming on Win7/8
Removed dependency upon netdom which is not always available on all Windows versions. This implementation that uses PowerShell and WMI should work on all OS and PowerShell versions.

Fixed another issue where host renames would always happen when the hostname was longer than 15 characters. The COMPUTERNAME environment variable only returns the first 15 characters so we no longer use that to check the current host name.
2014-06-25 12:15:01 -07:00
Shawn Neal c72a412600 Better WinRM command failure messaging
Command failures include the stdout and stderr in the error message just like the SSH communicator.
Its now possible to specify only an error_class and have that use the correct error_key by default.
2014-06-24 10:09:11 -07:00
Shawn Neal d4bd05883d Fixed issue 3987
Reboot the Windows guest after renaming the computer so changes take affect immediately before attempting to provision the box.

- Changed rename from wmic to netdom since netdom seems to work correctly in Windows 2008R2 and newer OSs.
- Fixed Windows guest error translations, the wrong namespace was specified in the yaml file.
2014-06-09 22:46:03 -07:00
Kalman Hazins bb052366f7 Change symbols inside hashes to 1.9 JSON-like syntax 2014-05-22 12:35:12 -04:00
Mitchell Hashimoto d7fa60b5df communicators/winrm: use winrm_info cap if available [GH-3832] 2014-05-20 20:13:36 -07:00
Shawn Neal 0d3979f80d Fixed issue 3816
Elevated command line is now rendered to a script which is uploaded to the guest and executed. This allows the command line itself to be less than 100 chars to start the script and any user commands are puts into the script which has unlimited* length.
2014-05-19 08:04:59 -07:00
YungSang a2ed1cd014 Revise the unit case, too 2014-05-13 15:23:38 -07:00
Mitchell Hashimoto ca6e2393bd core: providers can choose to not be defaultable [GH-3742] 2014-05-09 16:02:09 -07:00
Mitchell Hashimoto 745bdf6766 providers/docker: ability to specify build dir synced folder opts [GH-3727] 2014-05-08 18:46:03 -07:00
Mitchell Hashimoto a9029842a6 kernel/v2: multiple synced folder lines override each other 2014-05-08 18:39:13 -07:00
Mitchell Hashimoto 434a13b4e4 kernel/v2: automatically forward winrm if comm is winrm [GH-3685] 2014-05-08 17:00:55 -07:00
Gosha Arinich 7558524482 docker container links is actually a hash, fix tests 2014-05-08 21:27:58 +03:00
Mitchell Hashimoto 338328fa15 kernel/v2: hostnames can be one character [GH-3713] 2014-05-08 09:10:13 -07:00
Gilles Cornu 919b5245ff provisioners/chef: Rename a unit test file
This way these tests are part of `rake test:unit`

Similar to [GH-3673]
2014-05-08 06:00:58 +02:00
Fabio Rehm 7538d07233 providers/docker: Ensure long flags are used 2014-05-07 12:12:16 -03:00
Fabio Rehm 3ab5064e02 providers/docker: Add required configs and specs (build is green now) 2014-05-07 12:12:16 -03:00
Fabio Rehm 89db0f64e5 providers/docker: Rename test files for consistency 2014-05-07 11:19:36 -03:00
Mitchell Hashimoto ca428388d8 providers/docker: can set default provider to docker [GH-3662] 2014-05-06 21:49:49 -07:00
Mitchell Hashimoto d4087db7c5 core: no active machines if there is no vagrant env 2014-05-06 13:36:42 -07:00
Mitchell Hashimoto 45fc89877c core: MachineIndex valid test is better 2014-05-05 21:50:51 -07:00
Mitchell Hashimoto 5d94ab9e60 core: if state ID is NOT_CREATED_ID, destroy machine state 2014-05-05 21:44:34 -07:00
Mitchell Hashimoto d7a9bcda47 providers/docker: vagrant_machine setting works proprely 2014-05-05 21:13:15 -07:00
Mitchell Hashimoto 958684fd7e guests/debian: more tests for hostname 2014-05-05 09:31:54 -07:00
Mitchell Hashimoto 8e334d2f24 guests/debian: fix tests 2014-05-05 09:29:23 -07:00
Gilles Cornu e884dfad71 provisioners/ansible: try to improve unit tests
I still cannot explain the cause of these random errors in this unit test,
but it is anyway safe and suitable to update the test code as following:
- use stricter regular expression matching (-l is included in --limit)
- array lengths substraction instead of array contents substraction
2014-05-05 09:25:35 +02:00
Gilles Cornu 52a44de10c provisioners/ansible: show ansible-playbook in use
Motivation:
By printing out the ansible command used behind the scene, we can ease
the support effort to very quickly identify whether a problem is due to
Vagrant provisioner or Ansible itself.
2014-05-04 22:54:12 +02:00
Gilles Cornu a394d80254 provisioners/ansible: minor change in unit tests 2014-05-04 21:25:43 +02:00
Mitchell Hashimoto c5b3dbbf75 core: fix final test 2014-05-01 10:12:36 -07:00
Mitchell Hashimoto cca9bffa90 core: Can exclude providers 2014-05-01 09:50:35 -07:00
Mitchell Hashimoto ab9f91568e core: more intuitive logic around default providers 2014-05-01 09:46:40 -07:00
Mitchell Hashimoto ba6272cc48 Update tests 2014-05-01 09:41:59 -07:00
Mitchell Hashimoto a9dfb6b3bd core: default provider chosen by usability and prority 2014-05-01 09:40:52 -07:00
Mitchell Hashimoto 429bd73495 core: provider has default priority of 5 2014-05-01 09:26:36 -07:00