From b794fa4fe74c9063346dfed32727298aeecb2e8d Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Tue, 3 Apr 2018 11:37:16 -0500 Subject: [PATCH] Expose verbosity as a var, dedupe attr list. Fixes #36170 --- lib/ansible/utils/vars.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/ansible/utils/vars.py b/lib/ansible/utils/vars.py index 7270e79599f..9a3f960587d 100644 --- a/lib/ansible/utils/vars.py +++ b/lib/ansible/utils/vars.py @@ -146,16 +146,19 @@ def load_extra_vars(loader, options): def load_options_vars(options, version): options_vars = {'ansible_version': version} - aliases = {'check': 'check_mode', - 'diff': 'diff_mode', - 'inventory': 'inventory_sources', - 'subset': 'limit', - 'tags': 'run_tags'} + attrs = {'check': 'check_mode', + 'diff': 'diff_mode', + 'forks': 'forks', + 'inventory': 'inventory_sources', + 'skip_tags': 'skip_tags', + 'subset': 'limit', + 'tags': 'run_tags', + 'verbosity': 'verbosity'} - for attr in ('check', 'diff', 'forks', 'inventory', 'skip_tags', 'subset', 'tags'): + for attr, alias in attrs.items(): opt = getattr(options, attr, None) if opt is not None: - options_vars['ansible_%s' % aliases.get(attr, attr)] = opt + options_vars['ansible_%s' % alias] = opt return options_vars