Skip to content

Commit

Permalink
Ansible: add proxy settings support (juju#503)
Browse files Browse the repository at this point in the history
If a Juju environment exposes proxy settings, the call to
ansible-playbook needs to use http(s) proxy settings or it could
potentially fail due to network timeout.
  • Loading branch information
Alvaro Uría authored Aug 12, 2020
1 parent 4f81958 commit c192e3e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions charmhelpers/contrib/ansible/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ def apply_playbook(playbook, tags=None, extra_vars=None):

# we want ansible's log output to be unbuffered
env = os.environ.copy()
proxy_settings = charmhelpers.core.hookenv.env_proxy_settings()
if proxy_settings:
env.update(proxy_settings)
env['PYTHONUNBUFFERED'] = "1"
call = [
'ansible-playbook',
Expand Down

0 comments on commit c192e3e

Please sign in to comment.