Commit Graph

72 Commits

Author SHA1 Message Date
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
jjshoe 7ef8477e43 provisioners/ansible: Don't run with two --limits
Conflicts:
	test/unit/plugins/provisioners/ansible/provisioner_test.rb
2014-04-26 11:55:59 +02:00
Emilien Kenler b77bd3e6bb Unit test + vault password file existence check 2014-04-21 13:56:16 -07:00
Emilien Kenler dd06dffe85 Ansible Vault support
Add the following options to the Ansible provisioner:
- ask_vault_pass
- vault_password_file
2014-04-21 13:56:15 -07:00
Gilles Cornu 7ed17ae9ed provisioners/ansible: use strict boolean options
With this change, the ansible provisioner fully complies with
the current user documentation.
2014-04-12 13:48:15 +02:00
Gilles Cornu 0098b7604d provisioners/ansible: refer to inventory directory
By referring the directory that contains the generated inventory file,
users can easily provide more settings with additional files stored in
the same directory.
2014-04-11 08:20:32 +02:00
Mitchell Hashimoto 5a3a501455 provisioners/ansible: request SSH info within provisoin [GH-3111] 2014-03-11 09:03:23 -07:00
Gilles Cornu 1d09fc4a79 provisioners/ansible: add new option raw_ssh_args
Since the Ansible provisioner now potentially exports ANSIBLE_SSH_ARGS
variable, it is fair to allow to extend the content of this environment
variable (`ssh_args` parameters from ansible.cfg file have lower
priority)
2014-03-09 22:47:24 +01:00
Gilles Cornu 1c0bc20d21 Ansible: Re-enable ControlPersist defaults when ANSIBLE_SSH_ARGS is used
Solve problem discussed in [GH-2952]
2014-03-09 22:41:36 +01:00
Gilles Cornu 1d328f7021 provisioners/ansible: Disable host key checking
Close #3060
2014-03-06 23:55:08 +01:00
Gilles Cornu cf8bfb2347 Ansible: Refactor handling of SSH vars/attributes
Avoid repetitions by using (sometimes lazy loaded) instance attributes
2014-02-28 09:07:52 +01:00
Gilles Cornu db490c5da5 Ansible: force 'ssh' connection only when needed
Remain in 'smart' mode, unless Multiple SSH identities or SSH-Forwarding
are in use.
2014-02-28 09:07:51 +01:00
Bryan Hunt 9480edf05a Ansible: Support SSH-Forwarding
Credits: Problem was originally reported in
dba02f3526
by @picsolvebryan
2014-02-28 09:07:51 +01:00
Gilles Cornu ca1e30d405 Ansible: Support multiple private keys
Note that this feature requires to force `--connection=ssh`. This is not
a big deal as `paramiko` mode is deprecated and in most cases `smart`
mode enables `ssh` mode.
2014-02-28 09:07:51 +01:00
Gilles Cornu a62d28fd7f provisioners/ansible: remove an unused variable
Sorry, I missed that point in GH-2991 review.

[ci skip]
2014-02-28 09:00:05 +01:00
Gilles Cornu 1cd2fe56a0 ansible: generate inventory in .vagrant/... 2014-02-24 16:52:38 +01:00
Gilles Cornu 709f3f4e6f provisioners/ansible: Change --limit behaviours
- The implicit default limit is always set
- ansible.limit as an empty string won't disable the default limit, but
  will be passed as "--limit=" argument and ansible-playbook will return
  an error (provided host list is empty)
2014-02-16 11:39:15 +01:00
Gilles Cornu c2663f5d30 provisioners/ansible: Fix Group Management
- Support arbitrary depth of "groups of groups of ... groups"
- Skip ':vars' suffix, but allow group names with ':' (yes, Ansible
  accepts this character)
- Like for groups of machines, groups of groups can result "empty", but
  it is not an issue for Ansible. Recursive filter on the group tree is
  a bit hard to implement, and don't brind real added value at Vagrant
  level.
2014-02-16 11:20:00 +01:00
Gilles Cornu 466cf58476 ansible generated inventory: skip group variables
Except ':children' for groups of groups, it is safer to avoid generating
':suffix' blocks. At the moment Ansible only supports (but doesn't
recommend) group variables (:vars), and the Vagrant Ansible provisioner
won't support this way to define variables.
2014-02-02 23:28:04 +01:00
Gilles Cornu f564bf7410 Ansible Groups: Accept single item as String
Syntax errors in `ansible.groups` definition are not well handled:
Error returned: undefined method `each' for "machine1":String (NoMethodError)

Being tolerant here doesn't hurt and may avoid people get
confused/annoyed.
2014-02-02 23:21:06 +01:00
Gilles Cornu 84308964e2 ansible generated inventory: deal with orphan VMs
env.active_machines can potentiall return 'invalid' machines:
- Ignore machines that are not declared in current Vagrantfile
- Warn when machines are missing (it usually occurs when the VM is
  removed without `vagrant destroy` and some orphan metadata remains
  in .vagrant/machines/...)
2014-02-02 23:06:27 +01:00
Mark Aaron Shirley 3bf5032d4b Update Ansible provisioner to only create a single inventory file
The Ansible provisioner will now only create a single inventory file named,
"vagrant_ansible_inventory". All defined Vagrant machines will be added to
this inventory file. Provisioning will now include a "--limit=#{machine}"
option to scope Ansible provisioning tasks to just the current machine. Setting
the Ansible provisioner's "limit" config option will override the new default
limit. Ansible provisioning scripts will now have access to all other defined
machines and what groups they reside in.
2014-02-01 13:04:20 -08:00
Gilles Cornu e5f45e2b79 Ansible: Fix a bug in `raw_arguments` option
Without this change, it is not possible to pass more than one "raw"
argument, which was not the expected behavior. In addition to Array
format, String (for a single argument) is still accepted (for sake of
"backward compatibility" and ease of use).

Note: Due to low/expert usage of this option, I think that it is not
necessary to add more robust validation on this parameter (e.g. Array
of String type checking or argument syntax pattern matching). Use it at
your own risk ;-)
2013-12-16 21:20:10 +01:00
Mark Aaron Shirley 906579d25a Add ability to use Ansible groups in generated inventory. Fixes #2551. 2013-12-08 23:08:03 -08:00
Mitchell Hashimoto cd106986b4 provisioners/ansible: use the first private key
/cc @gildegoma - Does Ansible support multiple private keys? Vagrant
now does, so this isn't exactly safe.
2013-11-26 10:07:52 -08:00
Mitchell Hashimoto cc57933675 update changelog 2013-11-24 21:29:04 -08:00
Gilles Cornu 5aff4a1f20 Ansible: Improvements for 'extra_vars' argument
`extra_vars` argument can now:
- contains a hierarchical set of parameters (instead of flat Key-Value Pairs)
- alternatively refers to a configuration file (instead of embedded Hash)

See Ansible Documentation for version requirement details:
http://www.ansibleworks.com/docs/playbooks_variables.html#passing-variables-on-the-command-line
2013-10-12 00:29:39 +02:00
Matthew Johnson b514f0c321 remove extra alias for vvv verbosity 2013-10-04 15:32:10 -04:00
Matthew Johnson e5a2f1e8b7 fix ansible-playbook runs when verbosity is not specified 2013-10-04 02:58:49 -04:00
egghead 4f1a65f74b fixing default verbosity 2013-10-02 02:28:55 +00:00
jabclab c51952a68d Resolving #2194 (Ansible buffering output if run as subprocess) 2013-09-26 10:13:44 +01:00
Mitchell Hashimoto 36bd52713b provisioners/ansible: convert extra vars to strings [GH-2244] 2013-09-20 21:16:50 -07:00
Mitchell Hashimoto ee9fc00a04 provisioners/ansible: default output level is verbose [GH-2194] 2013-09-16 21:02:22 -07:00
Matthew Johnson 131ce4fc97 add ansible.host_key_checking configuration parameter 2013-09-13 22:48:12 -04:00
Gilles Cornu ce4f2824f4 Ansible: Support three available verbosity levels 2013-09-07 15:17:43 +02:00
Gilles Cornu 8a925e3461 Ansible: code cleanup and documentation update
Clean Up (code logic is kept unmodified):
* Remove repetition around `ansible.limit` option (merge conflict issue)
* Re-add missing comments from GH-1697 (merge conflict issue)
* Reorder instructions

Documentation for following changes:
* [GH-1697] add more options
* [GH-1979] extra verbosity option
2013-09-07 14:49:12 +02:00
Mitchell Hashimoto f82711259c provisioners/all: report proper invalid keys [GH-2117] 2013-09-04 16:57:15 -07:00
Mitchell Hashimoto 89ecb7850f Merge branch 'more_ansible_options' of https://github.com/gildegoma/vagrant into gildegoma-more_ansible_options
Conflicts:
	plugins/provisioners/ansible/provisioner.rb
2013-09-02 15:30:49 -07:00
Mitchell Hashimoto 949416c76c provisioners/ansible: use proper config name [GH-2104] 2013-08-31 21:48:41 -07:00
Mitchell Hashimoto 9e476330f4 provisioners/ansible: execute ansible with cwd of root_path [GH-2051] 2013-08-29 11:55:58 -07:00
Mitchell Hashimoto adb72b07d5 plugins/provisioners: put generated inventory file in vagrantfile dir 2013-08-28 16:54:44 -07:00
Mitchell Hashimoto 8445308830 Merge branch 'generate_ansible_hosts' of https://github.com/commandtab/vagrant into commandtab-generate_ansible_hosts
Conflicts:
	plugins/provisioners/ansible/provisioner.rb
2013-08-28 16:52:13 -07:00
Mitchell Hashimoto 02399a145c provisioners/ansible: allow verbose :extra to be string 2013-08-28 16:46:04 -07:00
Mitchell Hashimoto 99a51a1ba8 Merge pull request #1979 from bmabey/patch-1
provisioners/ansible: adds extra verbosity option
2013-08-28 16:45:04 -07:00
Ben Mabey bb3609e6b2 adds extra verbosity option to ansible provisioner 2013-08-12 09:31:54 -06:00
Gilles Cornu b061e02bc8 Add support for "ansible.skip_tags" attribute 2013-08-12 09:41:18 +02:00
Mitchell Hashimoto d237bc0657 provisioners/ansible: properly quote vars with spaces [GH-1984] 2013-08-09 11:51:36 -07:00
Mitchell Hashimoto 269f7c2cc6 Merge pull request #2007 from ches/ansible-exit-status
provisioners/ansible: Fix Ansible provisioner exit code reporting
2013-08-09 11:17:52 -07:00
Mitchell Hashimoto 17ecd05c5f plugins/provisioners/ansible: rename inventory_file to inventory_path
/cc @ches
2013-08-09 11:06:02 -07:00
Mitchell Hashimoto ac8b2c5047 plugins/provisioners/ansible: use exist? check
/cc @ches
2013-08-09 11:04:35 -07:00