mirror of
https://github.com/ansible/awx.git
synced 2026-02-23 14:05:59 -03:30
allow user to add ansible callback plugin paths to job runtime
This commit is contained in:
@@ -638,12 +638,17 @@ class RunJob(BaseTask):
|
|||||||
Build environment dictionary for ansible-playbook.
|
Build environment dictionary for ansible-playbook.
|
||||||
'''
|
'''
|
||||||
plugin_dir = self.get_path_to('..', 'plugins', 'callback')
|
plugin_dir = self.get_path_to('..', 'plugins', 'callback')
|
||||||
|
plugin_dirs = [plugin_dir]
|
||||||
|
if hasattr(settings, 'AWX_ANSIBLE_CALLBACK_PLUGINS') and \
|
||||||
|
settings.AWX_ANSIBLE_CALLBACK_PLUGINS:
|
||||||
|
plugin_dirs.append(settings.AWX_ANSIBLE_CALLBACK_PLUGINS)
|
||||||
|
plugin_path = ':'.join(plugin_dirs)
|
||||||
env = super(RunJob, self).build_env(job, **kwargs)
|
env = super(RunJob, self).build_env(job, **kwargs)
|
||||||
# Set environment variables needed for inventory and job event
|
# Set environment variables needed for inventory and job event
|
||||||
# callbacks to work.
|
# callbacks to work.
|
||||||
env['JOB_ID'] = str(job.pk)
|
env['JOB_ID'] = str(job.pk)
|
||||||
env['INVENTORY_ID'] = str(job.inventory.pk)
|
env['INVENTORY_ID'] = str(job.inventory.pk)
|
||||||
env['ANSIBLE_CALLBACK_PLUGINS'] = plugin_dir
|
env['ANSIBLE_CALLBACK_PLUGINS'] = plugin_path
|
||||||
env['REST_API_URL'] = settings.INTERNAL_API_URL
|
env['REST_API_URL'] = settings.INTERNAL_API_URL
|
||||||
env['REST_API_TOKEN'] = job.task_auth_token or ''
|
env['REST_API_TOKEN'] = job.task_auth_token or ''
|
||||||
env['CALLBACK_CONSUMER_PORT'] = str(settings.CALLBACK_CONSUMER_PORT)
|
env['CALLBACK_CONSUMER_PORT'] = str(settings.CALLBACK_CONSUMER_PORT)
|
||||||
|
|||||||
Reference in New Issue
Block a user