Ensure playbook execution respects CLI ENV vars
This change restores the ability to set environment variables on the CLI to augment or change ansible behaviours. Somewhere along the way, this capability was lost which can have a negative effect on CLI interactions and UX. Change-Id: Ieef1c7a07064a88bee43a1f4d9005007bfeb7c43 Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
parent
5d7bb16229
commit
6a6b7526fb
|
@ -460,7 +460,7 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
|
|||
|
||||
callback_whitelist = ','.join([callback_whitelist, 'profile_tasks'])
|
||||
|
||||
env = os.environ.copy()
|
||||
env = dict()
|
||||
env['ANSIBLE_SSH_ARGS'] = (
|
||||
'-o UserKnownHostsFile={} '
|
||||
'-o StrictHostKeyChecking=no '
|
||||
|
@ -590,6 +590,10 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
|
|||
if key:
|
||||
env['ANSIBLE_PRIVATE_KEY_FILE'] = key
|
||||
|
||||
# NOTE(cloudnull): Re-apply the original environment ensuring that
|
||||
# anything defined on the CLI is set accordingly.
|
||||
env.update(os.environ.copy())
|
||||
|
||||
if extra_env_variables:
|
||||
if not isinstance(extra_env_variables, dict):
|
||||
msg = "extra_env_variables must be a dict"
|
||||
|
|
Loading…
Reference in New Issue