Closed agrimal closed 2 weeks ago
Files identified in the description:
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.
cc @Lunik @Shaps @lgatellier @marwatk @metanovii @nejch @scodeman @sh0shin @suukit @waheedi @zanssa click here for bot help
@agrimal while I'm sure it'd be a nice to have to also explicitly set proxy via arguments, the de-facto standard way to configure this is via the HTTP_PROXY
, HTTPS_PROXY
and NO_PROXY
environment variables.
The gitlab modules use python-gitlab under the hood, which in turn uses requests
, and this respects the standard environment variables (https://requests.readthedocs.io/en/latest/user/advanced/#proxies). So IMO it's best to just do that, but maybe others disagree. Just consider that (from a quick search) no other module in this collection provides an explicit argument for this, so I think that's just what people do.
Source: I do this at work using gitlab modules as well.
Thanks for your answer. I can't set the variables directly on the command line as I have to use different proxies depending on the destination.
@agrimal you don't need to set them on the CLI, you do it in ansible. E.g.
- hosts: your_hosts
vars:
ansible_become: true
environment:
http_proxy: "{{ proxy_server }}"
https_proxy: "{{ proxy_server }}"
no_proxy: "{{ no_proxy }}"
I'm fairly sure you can even do it at the task level if needed.
These are already set in my task :
- name: Create gitlab project
environment:
http_proxy: "{{ proxy }}"
http_proxys: "{{ proxy }}"
community.general.gitlab_project:
api_url: "{{ api_url }}"
api_token: "{{ api_token }}"
name: "{{ name }}"
group: "{{ group }}"
initialize_with_readme: true
delegate_to: localhost
become: false
@agrimal haha sorry I misread the initial description.
So you just have a typo. It should be https_proxy
, not http_proxys
. Since your GitLab instance is likely served over HTTPS that's the one that matters.
OMG thanks for pointing out this typo... Works better now ! I'm closing this non-issue
Summary
Hello, I'm behind a HTTP proxy for accessing gitlab and I can't see a way to set it for this module. As far as I can see, I can't use this module.
Issue Type
Bug Report
Component Name
gitlab_project
Ansible Version
Community.general Version
Configuration
No response
OS / Environment
Debian 12
Steps to Reproduce
Expected Results
the module uses the configured proxy
Actual Results
It's not working, the module is trying to access directly instead of using the proxy
Code of Conduct