mirror of
https://github.com/ansible/awx.git
synced 2026-11-22 00:06:10 -03:30
Implement extra vars on ad-hoc commands
This commit is contained in:
@@ -84,6 +84,12 @@ class AdHocCommand(UnifiedJob):
|
||||
editable=False,
|
||||
through='AdHocCommandEvent',
|
||||
)
|
||||
extra_vars = models.TextField(
|
||||
blank=True,
|
||||
default='',
|
||||
)
|
||||
|
||||
extra_vars_dict = VarsDictProperty('extra_vars', True)
|
||||
|
||||
def clean_inventory(self):
|
||||
inv = self.inventory
|
||||
|
||||
@@ -1615,6 +1615,9 @@ class RunAdHocCommand(BaseTask):
|
||||
if ad_hoc_command.verbosity:
|
||||
args.append('-%s' % ('v' * min(5, ad_hoc_command.verbosity)))
|
||||
|
||||
if ad_hoc_command.extra_vars_dict:
|
||||
args.extend(['-e', json.dumps(ad_hoc_command.extra_vars_dict)])
|
||||
|
||||
args.extend(['-m', ad_hoc_command.module_name])
|
||||
args.extend(['-a', ad_hoc_command.module_args])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user