diff --git a/tripleoclient/utils.py b/tripleoclient/utils.py index dfb50dda5..9f7c381ea 100644 --- a/tripleoclient/utils.py +++ b/tripleoclient/utils.py @@ -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 ' @@ -596,6 +596,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"