Commit Graph

731 Commits

Author SHA1 Message Date
Brian Cain a05d95bd0a (#7139) Add post-install provisioner to docker provisioner
Prior to this commit, if a user attempted to configure
`/etc/default/docker` through vagrant prior to installation, the package
manager would not override an existing configuration and installing
docker would then fail. This commit fixes this by introducing a
`post_install_provisioner` that allows users to define a provisioner
block that will run after docker has been installed, allowing users to
configure `/etc/default/docker` how they want.
2017-06-27 16:01:23 -07:00
Chris Roberts d260fe7d38 Merge pull request #7865 from DavidWittman/7454-fix-salt-minion-id-config
Fix minion_id config for salt provisioner
2017-06-15 16:01:33 -07:00
Chris Roberts 6906dbc558 Merge pull request #8467 from MartinNowak/patch-1
fix `config.ssh.keys_only = false` for ansible
2017-06-14 16:54:24 -07:00
Andreas Olsson f6a9dcdd6f Catch pip_args in FreeBSD's and SUSE's ansible_install
While neither the FreeBSD provisioner nor the SUSE provisioner support
installing Ansible using pip their ansible_install methods still get
called with that fourth argument. The result being these errors when
Vagrant tries to install Ansible.

    /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/plugins/provisioners/ansible/cap/guest/freebsd/ansible_install.rb:10:in `ansible_install': wrong number of arguments (4 for 3) (ArgumentError)
    /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/plugins/provisioners/ansible/cap/guest/suse/ansible_install.rb:9:in `ansible_install': wrong number of arguments (4 for 3) (ArgumentError)

The Arch provider, it too without pip support, already catches the
pip_args argument this way.
2017-06-14 21:01:44 +02:00
Chris Roberts 71bfe7c884 Fix shell provisioner to execute batch files correctly
Call cmd.exe explicitly when running batch files to easily
manage special characters that may be within the path.

Fixes #8535
2017-04-28 15:05:08 -07:00
Chris Roberts 0e89fdf182 Merge pull request #8498 from chrisroberts/win/spaces
Quote exec_path to properly handle spaces in path
2017-04-20 16:08:24 -07:00
Chris Roberts c963532d6e Use configured upload path for winssh communicator 2017-04-20 16:05:41 -07:00
Chris Roberts 82e268a3e2 Quote exec_path to properly handle spaces in path
Fixes #7234
2017-04-19 12:23:55 -07:00
Chris Roberts 232a44f46d Merge pull request #8485 from chrisroberts/communicators/win-ssh
Add winssh communicator
2017-04-17 08:21:33 -07:00
Chris Roberts 9c127a4401 Merge pull request #8443 from anandsuresh/feature/freebsd-chef-installed
Add chef_install(ed?) guest capability for freebsd
2017-04-16 08:23:16 -07:00
Chris Roberts c56acfab94 Add WinSSH communicator 2017-04-15 07:12:58 -07:00
Dafydd Jones 71216cf4f9 update latest salt minion version for windows 2017-04-13 12:36:45 -07:00
Martin Nowak 1ca247f516 fix `config.ssh.keys_only = false` for ansible
Also see #5017.
2017-04-12 12:31:00 +02:00
Anand Suresh 30f4eb62ea Add chef_install(ed?) guest capability for freebsd 2017-04-04 22:10:02 -07:00
knbnnate 8c31a0c3ff Salt ver year.month can have 2-digit month 2017-03-30 17:00:46 -04:00
Gilles Cornu 80d105cf8c
ansible_local: Add the :pip_args_only install mode
With the introduction of `pip_args` option, you can easily extend the
`:pip` installation mode behaviour. But some interesting/advanced usages
are still not possible because of the auto-generated parts ("ansible"
package, version selection, and the `--upgrade` flag).

By adding this "pip_args_only" install mode, it will be for instance
possible to:
- install unofficial releases, like release candidates published at
  https://releases.ansible.com/
- install more pip packages (e.g. via a `requirements.txt` file), with
  hash validation, etc.

Note that there is no config validation that requires `pip_args` option
to be defined when the :pip_args_only mode is selected. This would be
more elegant, and user friendly to raise a configuration error, but this
can wait. At least, running with an empty `pip_args` won't lead to any
command crash, since the rather dummy "pip install" shows an helper
notice and terminates with a zero (0) exit code.

This change is thought as a complement to the changes originally
proposed in pull request GH-8170.
2017-03-24 17:35:34 +01:00
Gilles Cornu b40d347944
ansible_local: Polish the new `pip_args` option
Ref GH-8170
2017-03-24 00:01:17 +01:00
James Carr 7e2e5654ed
ansible_local: Add `pip_args` option
With this new option, it is now possible to pass additional arguments to
pip command when the `install_mode` is "pip".

(@gildegoma reworded the original commit message of pull request GH-8170)
2017-03-24 00:01:14 +01:00
Chris Roberts 7a03c6e013 Add /bin/docker to path list for installation verification 2017-03-20 11:38:44 -07:00
Gilles Cornu 8caed8ea16 Merge pull request #7918 from mitchellh/gildegoma/fix-7195
Add `config_file` option to both Ansible provisioners
2016-11-15 08:29:30 +01:00
Chris Roberts 0f720a4386 Merge pull request #7985 from chrisroberts/shell-provisioner/checksum
Add md5 and sha1 checksum support to Downloader.
2016-11-14 13:19:22 -08:00
Chris Roberts 2219a4def0 Fix Hash construction for constant value in salt provisioner 2016-11-09 16:29:36 -08:00
Chris Roberts da45ca707c Add md5 and sha1 checksum support to Downloader.
Allows checksum validation on downloaded files via Util::Downloader
using MD5 and/or SHA1 checksums. This also integrates checksum validation
support with the shell provisioner for downloaded remote files.
2016-11-09 16:05:39 -08:00
Chris Roberts dbbd2d8e36 Remove deprecated methods and update tests. 2016-11-07 18:48:14 -08:00
Chris Roberts 58c3be9344 Default the puppet config environment variables to an empty hash 2016-10-27 15:14:13 -07:00
Chris Roberts 9b12d4db48 Pass configuration environment variables to apply command 2016-10-26 09:51:56 -07:00
Azul a4408037ba add support for environment variables on a puppet apply run 2016-10-26 09:36:34 -07:00
Chris Roberts 3ee2bca793 Merge pull request #7907 from chrisroberts/salt-config/defaults
provisioners/salt: Synchronize config defaults with documentation
2016-10-24 07:07:41 -07:00
Gilles Cornu b9174895a5
provisioners/ansible (minor): Fix alphabetical order of base attributes
This point was missed in #6627.
2016-10-23 20:46:30 +02:00
Gilles Cornu a842abbc38
provisioners/ansible(both): Add config_file option
With this new option defined, the `ansible-galaxy` and
`ansible-playbook` commands generated by the Ansible provisioners will
be executed with the ANSIBLE_CONFIG environment variable set
accordingly.

Resolve GH-7195

This commit also fix the following open issues:
- Implement the pending RSpec examples about path existence checks
  performed by the ansible (remote) provisioner.
- In verbose mode, the ansible remote provisioner now correctly displays
  the Ansible Galaxy parameters ("role_file" and "roles_path") with
  single quotes (which is safer for potential copy-paste usage).

Additional Notes:
- Test coverage for `ansible_local` provisioner is still not
  implemented. See GH-6633.
- Test coverage for galaxy from host is not implemented yet (due to
  general issue with mocking both command executions, see
  https://github.com/mitchellh/vagrant/pull/6529#r45278451
2016-10-22 01:09:12 +02:00
Gilles Cornu d56cf55a89
provisioners/ansible_local: Use quotes for path checking
Without this fix, the ansible_local provisioner fails to check the
existence of a filesystem path that contains a blank/space character.
2016-10-21 16:44:18 +02:00
Gilles Cornu 432f79339c
provisioners/ansible(base): Add parenthesis for better readability
Make more evident on what the "if modifiers" (aka trailing conditionals) apply.
2016-10-21 16:43:37 +02:00
Chris Roberts fa2a9105f0 provisioners/salt: Synchronize config defaults with documentation 2016-10-17 10:11:39 -07:00
Gilles Cornu a55590b84f
provisioners/ansible_local: Change binary detection
- Remove `ansible-galaxy` detection, since this command was introduced
  in Ansible 1.4.2 (December 2013). Checking for `ansible-playbook`
  presence should therefore be enough for any "modern" Ansible setup.
- Look for the command defined by the new `playbook_command` option.

Related to GH-7881 and GH-7536
2016-10-10 23:24:19 +02:00
Gilles Cornu b1ddc98e17
Merge pull request #7881 (Add playbook_command option)
Note that error messages were not adapted, and only mention
a generic "Ansible Software" when executed commands are failing.
We assume that people using the `playbook_command` option are
advanced users that will know all the components to be considered.
2016-10-10 23:18:24 +02:00
Gilles Cornu 26e8bdc1f1
Merge pull request #7536 2016-10-10 23:03:00 +02:00
Daniel Gonzalez 58f2b0c8c7 Make ansible-playbook command configurable
The ansible-playbook command is currently hardcoded for the ansible and
ansible_local provisioners. This patch adds the config option
playbook_command to allow the user to change the command.
2016-10-09 20:48:50 +02:00
David Wittman 00c7b1e005
Fix minion_id config for salt provisioner
Changes introduced in #7207 removed the logic to handle the
`minion_id` configuration. This commit addresses that regression
by including the `--id #{@config.minion_id}` flag everywhere that
`--local` is used (as it had done before).

I'm not totally in love with the `get_masterless` abstraction here,
so if someone has a better suggestion I'll happily change it.

Fixes #7454
2016-10-04 16:46:36 -05:00
Gilles Cornu e8cf9bb168
provisioners/ansible: review pull request #7752
- Honour `ssh.proxy_command` setting (even when the Docker provider is
  used via a proxy host). Silly configurations may lead to silly
  behaviors, but let's apply the settings...
- Remove condition on `provider_config.connect_via_ssh`, which is
  a provider specific parameter (from vagrant-libvirt provider).
- Add a simple unit test
2016-09-21 23:40:20 +02:00
Dmitry Vasilets a1d78edaf8
changes after review 2016-09-21 23:40:15 +02:00
Dmitry Vasilets a943f67da1
support ansible for remote servers and vm 2016-09-21 23:39:43 +02:00
Hanno Heinrichs 10775a3b4a More robust Ansible detection for local Ansible provisioner 2016-06-30 12:58:36 +02:00
Gilles Cornu a7dfc73b85 provisioners/ansible: honor galaxy_roles_path when running ansible-playbook
This commit include the following changes:
- systematically set ANSIBLE_ROLES_PATH environment variable when
  galaxy_roles_path is defined.
- slightly refactor to introduce the concept of "provisioning working
  directory" (possible usage in the future for resolving GH-7195)
- fix a bug in ansible-galaxy execution by the ansible_local provisioner
  if the paths contains blank characters.

Fix #7269
2016-06-11 07:28:05 +02:00
Gilles Cornu 6ee8bb6a84 provisioners/ansible_local: Fix Fedora/RedHat "default" installation mode
With bb9dba56ac, I introduced a pitiful
regression in "rpm-based" Ansible installation (via yum or dnf).

This fix is part of GH-6654
2016-06-09 19:16:47 +02:00
Gilles Cornu 6ee69e3150 Merge pull request #7190 from electrofelix/ansible-parallel-race
Fix a race condition in the concurrent generations of the ansible inventory file, while running `vagrant up --parallel`.

Closes GH-6526
2016-06-09 14:56:03 +02:00
Gilles Cornu eb1e8f8673 provisioners/ansible(both): apply ruby 2.x style
Use Ruby 2.0 syntax for named parameters and hash entries.
2016-06-08 23:53:58 +02:00
Gilles Cornu d57b7201c4 provisioners/ansible_local: align code style
Remove parenthesis to all "machine.communicate." method calls in the
"cap/guest" files...
2016-06-08 23:53:58 +02:00
Gilles Cornu bb9dba56ac provisioners/ansible_local: add "pip" install_mode
These changes have been validated against the following guest systems:
- Debian 7 and 8
- Ubuntu 12.04, 14.04 and 16.04
- Fedora 21 and 23
- CentOS 7
- OracleLinux 7
- Scientific Linux 7

At the moment, the pip setup (via get-pip.py script) is not working for
RHEL6-like systems (CentOS 6.6, OracleLinux 6.5, Scientific Linux 6),
because Python 2.6 has been deprecated and is no longer supported by
Python core team. I consider this limitation with low priority in
Vagrant context.

The `:pip` install_mode is currently not implemented for the following
platforms:
- OpenSUSE
- ArchLinux
- FreeBSD

Known Issue: By using get-pip.py script, any previous pip installation
will be most probably overrided. This could be an issue for Python
developers who would prefer to keep their base box setup untouched. In
future iteration, it could be possible to choose to reinstall/upgrade
pip or not. issue for Python developers who would prefer to keep their
base box setup untouched. In future iteration, it could be possible to
choose to reinstall/upgrade pip or not.

Resolve GH-6654

Resolve GH-7167 as the `version` option is now considered to select the
version of Ansible to be installed.
2016-06-08 23:53:58 +02:00
Seth Vargo d45dc0c9d9 Merge pull request #7207 from msarahan/salt_masterless_rework
Salt: move masterless config to apply to all platforms
2016-06-06 19:28:29 -04:00
Seth Vargo e925f3793a
provisioners/chef: Install in one command 2016-06-06 18:22:17 -04:00