pip - Why isn't Ansible respecting my system proxy settings? -
i'm 1 of people fortunate enough have corporate proxy breaks ssl! /s
my environment has http_proxy, https_proxy, http_proxy, , https_proxy correctly configured. configuration via shell script in /etc/profile.d sets 4 environment variables me.
i'm trying use ansible install packages pip. here's problem.
i can log in system , type following command:
pip install --trusted-host pypi.python.org robotframework ... , work. i've tried doing same thing inside ansible both using command , pip modules. no joy.
using pip module:
- name: install robotframework pip: name=robotframework extra_args='--trusted-host pypi.python.org' become: true results in this:
fatal: [localhost]: failed! => {"changed": false, "cmd": "/bin/pip install --trusted-host pypi.python.org robotframework", "failed": true, " invocation": {"module_args": {"chdir": null, "editable": true, "executable": null, "extra_args": "--trusted-host pypi.python.org", "name": " robotframework", "requirements": null, "state": "present", "umask": null, "use_mirrors": true, "version": null, "virtualenv": null, "virtual env_command": "virtualenv", "virtualenv_python": null, "virtualenv_site_packages": false}, "module_name": "pip"}, "msg": "stdout: collecting robotframework\n\n:stderr: using pip version 7.1.0, version 9.0.1 available.\nyou should consider upgrading via 'pip install --upgrade pip' command.\n retrying (retry(total=4, connect=none, read=none, redirect=none)) after connection broken 'protocoler ror('connection aborted.', error(101, 'network unreachable'))': /simple/robotframework/\n retrying (retry(total=3, connect=none, read=no ne, redirect=none)) after connection broken 'protocolerror('connection aborted.', error(101, 'network unreachable'))': /simple/robotfr amework/\n retrying (retry(total=2, connect=none, read=none, redirect=none)) after connection broken 'protocolerror('connection aborted. ', error(101, 'network unreachable'))': /simple/robotframework/\n retrying (retry(total=1, connect=none, read=none, redirect=none)) afte r connection broken 'protocolerror('connection aborted.', error(101, 'network unreachable'))': /simple/robotframework/\n retrying (re try(total=0, connect=none, read=none, redirect=none)) after connection broken 'protocolerror('connection aborted.', error(101, 'network s unreachable'))': /simple/robotframework/\n retrying (retry(total=4, connect=none, read=none, redirect=none)) after connection broken ' protocolerror('connection aborted.', error(101, 'network unreachable'))': /simple/robotframework/\n retrying (retry(total=3, connect=non e, read=none, redirect=none)) after connection broken 'protocolerror('connection aborted.', error(101, 'network unreachable'))': /simp le/robotframework/\n retrying (retry(total=2, connect=none, read=none, redirect=none)) after connection broken 'protocolerror('connectio n aborted.', error(101, 'network unreachable'))': /simple/robotframework/\n retrying (retry(total=1, connect=none, read=none, redirect=n one)) after connection broken 'protocolerror('connection aborted.', error(101, 'network unreachable'))': /simple/robotframework/\n re trying (retry(total=0, connect=none, read=none, redirect=none)) after connection broken 'protocolerror('connection aborted.', error(101, 'network unreachable'))': /simple/robotframework/\n not find version satisfies requirement robotframework (from version s: )\nno matching distribution found robotframework\n"} using command module:
- name: install robotframework command: "pip install --trusted-host pypi.python.org robotframework" become: true results in this:
fatal: [localhost]: failed! => {"changed": true, "cmd": ["pip", "install", "--trusted-host", "pypi.python.org", "robotframework"], "delta": "0:03:16.916685", "end": "2016-11-10 13:26:12.486105", "failed": true, "invocation": {"module_args": {"_raw_params": "pip install --trusted- host pypi.python.org robotframework", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": tru e}, "module_name": "command"}, "rc": 1, "start": "2016-11-10 13:22:55.569420", "stderr": "you using pip version 7.1.0, version 9 .0.1 available.\nyou should consider upgrading via 'pip install --upgrade pip' command.\n retrying (retry(total=4, connect=none, rea d=none, redirect=none)) after connection broken 'protocolerror('connection aborted.', error(101, 'network unreachable'))': /simple/rob otframework/\n retrying (retry(total=3, connect=none, read=none, redirect=none)) after connection broken 'protocolerror('connection abor ted.', error(101, 'network unreachable'))': /simple/robotframework/\n retrying (retry(total=2, connect=none, read=none, redirect=none)) after connection broken 'protocolerror('connection aborted.', error(101, 'network unreachable'))': /simple/robotframework/\n retrying (retry(total=1, connect=none, read=none, redirect=none)) after connection broken 'protocolerror('connection aborted.', error(101, 'netwo rk unreachable'))': /simple/robotframework/\n retrying (retry(total=0, connect=none, read=none, redirect=none)) after connection broken 'protocolerror('connection aborted.', error(101, 'network unreachable'))': /simple/robotframework/\n retrying (retry(total=4, connect =none, read=none, redirect=none)) after connection broken 'protocolerror('connection aborted.', error(101, 'network unreachable'))': / simple/robotframework/\n retrying (retry(total=3, connect=none, read=none, redirect=none)) after connection broken 'protocolerror('conne ction aborted.', error(101, 'network unreachable'))': /simple/robotframework/\n retrying (retry(total=2, connect=none, read=none, redire ct=none)) after connection broken 'protocolerror('connection aborted.', error(101, 'network unreachable'))': /simple/robotframework/\n retrying (retry(total=1, connect=none, read=none, redirect=none)) after connection broken 'protocolerror('connection aborted.', error(1 01, 'network unreachable'))': /simple/robotframework/\n retrying (retry(total=0, connect=none, read=none, redirect=none)) after connecti on broken 'protocolerror('connection aborted.', error(101, 'network unreachable'))': /simple/robotframework/\n not find versi on satisfies requirement robotframework (from versions: )\nno matching distribution found robotframework", "stdout": "collectin g robotframework", "stdout_lines": ["collecting robotframework"], "warnings": []} i totally @ loss. thought might have been funny root user, until logged in root user , ran pip command @ shell. know i'm on old version of pip (thank epel that), shouldn't causing command invocation fail. when try upgrading pip warning states, same result.
the thing worked redundantly specifying proxy url in task:
- name: install robot framework pip: name=robotframework extra_args='--trusted-host pypi.python.org' environment: http_proxy: http://proxy1.example.com:8080 https_proxy: http://proxy1.example.com:8080 http_proxy: http://proxy1.example.com:8080 https_proxy: http://proxy1.example.com:8080 become: true become_user: root why need this? if log in root can see environment variables set. shouldn't need set them in ansible, too.
if log in root can see environment variables set. shouldn't need set them in ansible, too.
incorrect! :) you're setting variables in file ~/.bashrc, run on interactive shells.
there's a section of documentation devoted working environment variables, specific emphasis on proxy use.
Comments
Post a Comment