Merge pull request #2320 from copperlight/ansible-provisioner

provisioners/ansible: fix ansible-playbook runs when ansible.verbose is not specified
This commit is contained in:
Mitchell Hashimoto 2013-10-05 09:26:51 -07:00
commit 1c63d2407a
2 changed files with 8 additions and 8 deletions

View File

@ -27,7 +27,7 @@ module VagrantPlugins
options << "--inventory-file=#{self.setup_inventory_file}"
options << "--sudo" if config.sudo
options << "--sudo-user=#{config.sudo_user}" if config.sudo_user
options << "#{self.get_verbosity_argument}"
options << "#{self.get_verbosity_argument}" if config.verbose
options << "--ask-sudo-pass" if config.ask_sudo_pass
options << "--tags=#{as_list_argument(config.tags)}" if config.tags
options << "--skip-tags=#{as_list_argument(config.skip_tags)}" if config.skip_tags
@ -85,13 +85,11 @@ module VagrantPlugins
def get_verbosity_argument
if config.verbose.to_s =~ /^v+$/
# Hopefully ansible-playbook accepts "silly" arguments like '-vvvvv', as '-vvv'
# ansible-playbook accepts "silly" arguments like '-vvvvv' as '-vvvv' for now
return "-#{config.verbose}"
elsif config.verbose.to_s == 'extra'
return '-vvv'
else
# fall back to default verbosity (which is no verbosity)
return ''
# safe default, in case input strays
return '-v'
end
end

View File

@ -132,9 +132,11 @@ These variables take the highest precedence over any other variables.
by the sudo command.
* `ansible.ask_sudo_pass` can be set to `true` to require Ansible to prompt for a sudo password.
* `ansible.limit` can be set to a string or an array of machines or groups from the inventory file to further narrow down which hosts are affected.
* `ansible.verbose` can be set to increase Ansible's verbosity to obtain full detailed logging. By default, Vagrant uses Ansible default verbosity (`--verbose` or `-v`). By enabling this option following higher verbosity can be activated:
* `ansible.verbose` can be set to increase Ansible's verbosity to obtain detailed logging:
* `'v'`, verbose mode
* `'vv'`
* `'vvv'`, also aliased as `'extra'`
* `'vvv'`, more
* `'vvvv'`, connection debugging
* `ansible.tags` can be set to a string or an array of tags. Only plays, roles and tasks tagged with these values will be executed.
* `ansible.skip_tags` can be set to a string or an array of tags. Only plays, roles and tasks that *do not match* these values will be executed.
* `ansible.start_at_task` can be set to a string corresponding to the task name where the playbook provision will start.