fix ansible-playbook runs when verbosity is not specified

This commit is contained in:
Matthew Johnson 2013-10-04 02:58:49 -04:00
parent bf70fba936
commit e5a2f1e8b7
2 changed files with 6 additions and 7 deletions

View File

@ -27,7 +27,7 @@ module VagrantPlugins
options << "--inventory-file=#{self.setup_inventory_file}" options << "--inventory-file=#{self.setup_inventory_file}"
options << "--sudo" if config.sudo options << "--sudo" if config.sudo
options << "--sudo-user=#{config.sudo_user}" if config.sudo_user 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 << "--ask-sudo-pass" if config.ask_sudo_pass
options << "--tags=#{as_list_argument(config.tags)}" if config.tags options << "--tags=#{as_list_argument(config.tags)}" if config.tags
options << "--skip-tags=#{as_list_argument(config.skip_tags)}" if config.skip_tags options << "--skip-tags=#{as_list_argument(config.skip_tags)}" if config.skip_tags
@ -85,13 +85,10 @@ module VagrantPlugins
def get_verbosity_argument def get_verbosity_argument
if config.verbose.to_s =~ /^v+$/ 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}" return "-#{config.verbose}"
elsif config.verbose.to_s == 'extra' elsif config.verbose.to_s == 'extra'
return '-vvv' return '-vvv'
else
# fall back to default verbosity (which is no verbosity)
return ''
end end
end end

View File

@ -132,9 +132,11 @@ These variables take the highest precedence over any other variables.
by the sudo command. by the sudo command.
* `ansible.ask_sudo_pass` can be set to `true` to require Ansible to prompt for a sudo password. * `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.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'` * `'vv'`
* `'vvv'`, also aliased as `'extra'` * `'vvv'`, more (aliased as `'extra'`)
* `'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.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.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. * `ansible.start_at_task` can be set to a string corresponding to the task name where the playbook provision will start.