Ansible galaxy behind a http proxy

Hi,

i am following the tutorial at Galaxy Installation with Ansible to setup a galaxy instance using ansible.

I am at the step afer setting up an ansible-vault where galaxy should be deployed and dependencies installed etc., unfortunately the tutorial does not take into account a situation where you are located behind a http(s) proxy as far as i can tell.

For the errors I got with git and pip I was able to set the proxy settings globally, but now for the nodejs install with nodeenv I am at a point where i cant seem to solve it.

Is there some way to specify proxy information in the ansible playbook or a work around to install it (though i guess the proxy will produce more problems down the line)?

Here is the last few outputs of ansbile and the error message for nodeenv:

TASK [galaxyproject.galaxy : Ensure galaxy_node_version is set] ******************************************************************************************************************************
included: /home/galaxy/galaxy_install_tutorial/galaxy/roles/galaxyproject.galaxy/tasks/_inc_node_version.yml for x

TASK [galaxyproject.galaxy : Collect Galaxy Node.js version file] ****************************************************************************************************************************
ok: [x]

TASK [galaxyproject.galaxy : Set Galaxy Node.js version fact] ********************************************************************************************************************************
ok: [x]

TASK [galaxyproject.galaxy : Check whether nodeenv is available] *****************************************************************************************************************************
ok: [x]

TASK [galaxyproject.galaxy : Create Galaxy virtualenv] ***************************************************************************************************************************************
skipping: [x]

TASK [galaxyproject.galaxy : Ensure pip is the desired release] ******************************************************************************************************************************
skipping: [x]

TASK [galaxyproject.galaxy : Ensure setuptools is latest working release (<58)] **************************************************************************************************************
skipping: [x]

TASK [galaxyproject.galaxy : Install nodeenv if it doesn't exist] ****************************************************************************************************************************
skipping: [x]

TASK [galaxyproject.galaxy : Report preferred Node.js version] *******************************************************************************************************************************
ok: [x] => 
  galaxy_node_version: 16.13.2

TASK [galaxyproject.galaxy : Check if node is installed] *************************************************************************************************************************************
ok: [x]

TASK [galaxyproject.galaxy : Collect installed node version] *********************************************************************************************************************************
skipping: [x]

TASK [galaxyproject.galaxy : Remove node_modules directory when upgrading node] **************************************************************************************************************
ok: [x]

TASK [galaxyproject.galaxy : Install or upgrade node] ****************************************************************************************************************************************
fatal: [x]: FAILED! => changed=true 
  cmd:
  - nodeenv
  - -n
  - 16.13.2
  - -p
  delta: '0:04:20.971769'
  end: '2023-01-23 12:56:49.502045'
  msg: non-zero return code
  rc: 1
  start: '2023-01-23 12:52:28.530276'
  stderr: |2-
     * Install prebuilt node (16.13.2) .
    Traceback (most recent call last):
      File "/usr/lib/python3.8/urllib/request.py", line 1354, in do_open
        h.request(req.get_method(), req.selector, req.data, headers,
      File "/usr/lib/python3.8/http/client.py", line 1256, in request
        self._send_request(method, url, body, headers, encode_chunked)
      File "/usr/lib/python3.8/http/client.py", line 1302, in _send_request
        self.endheaders(body, encode_chunked=encode_chunked)
      File "/usr/lib/python3.8/http/client.py", line 1251, in endheaders
        self._send_output(message_body, encode_chunked=encode_chunked)
      File "/usr/lib/python3.8/http/client.py", line 1011, in _send_output
        self.send(msg)
      File "/usr/lib/python3.8/http/client.py", line 951, in send
        self.connect()
      File "/usr/lib/python3.8/http/client.py", line 1418, in connect
        super().connect()
      File "/usr/lib/python3.8/http/client.py", line 922, in connect
        self.sock = self._create_connection(
      File "/usr/lib/python3.8/socket.py", line 808, in create_connection
        raise err
      File "/usr/lib/python3.8/socket.py", line 796, in create_connection
        sock.connect(sa)
    OSError: [Errno 101] Network is unreachable
  
    During handling of the above exception, another exception occurred:
  
    Traceback (most recent call last):
      File "/srv/galaxy/venv/bin/nodeenv", line 8, in <module>
        sys.exit(main())
      File "/srv/galaxy/venv/lib/python3.8/site-packages/nodeenv.py", line 1079, in main
        create_environment(env_dir, opt)
      File "/srv/galaxy/venv/lib/python3.8/site-packages/nodeenv.py", line 956, in create_environment
        install_node(env_dir, src_dir, opt)
      File "/srv/galaxy/venv/lib/python3.8/site-packages/nodeenv.py", line 721, in install_node
        install_node_wrapped(env_dir, src_dir, opt)
      File "/srv/galaxy/venv/lib/python3.8/site-packages/nodeenv.py", line 743, in install_node_wrapped
        download_node_src(node_url, src_dir, opt)
      File "/srv/galaxy/venv/lib/python3.8/site-packages/nodeenv.py", line 570, in download_node_src
        dl_contents = io.BytesIO(urlopen(node_url).read())
      File "/srv/galaxy/venv/lib/python3.8/site-packages/nodeenv.py", line 606, in urlopen
        return urllib2.urlopen(req)
      File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen
        return opener.open(url, data, timeout)
      File "/usr/lib/python3.8/urllib/request.py", line 525, in open
        response = self._open(req, data)
      File "/usr/lib/python3.8/urllib/request.py", line 542, in _open
        result = self._call_chain(self.handle_open, protocol, protocol +
      File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
        result = func(*args)
      File "/usr/lib/python3.8/urllib/request.py", line 1397, in https_open
        return self.do_open(http.client.HTTPSConnection, req,
      File "/usr/lib/python3.8/urllib/request.py", line 1357, in do_open
        raise URLError(err)
    urllib.error.URLError: <urlopen error [Errno 101] Network is unreachable>
  stderr_lines: <omitted>
  stdout: ''
  stdout_lines: <omitted>

PLAY RECAP ***********************************************************************************************************************************************************************************
x : ok=78   changed=8    unreachable=0    failed=1    skipped=43   rescued=0    ignored=0

I managed to “fix” the error by running the playbook as root user after getting access from my admins.

Previously I was executing it as sudo allowed “normal” user.