-
Notifications
You must be signed in to change notification settings - Fork 60
Closed
Labels
Description
Describe the request
Add proxy support to all v4 API client modules, allowing users to connect to Nutanix clusters through HTTP/HTTPS proxies. Proxy configuration can be set via:
- Module parameters (highest priority)
- Environment variables using either:
- Shell
exportcommand before running the playbook - The
environmentkey in the playbook
- Shell
Supported proxy parameters:
https_proxy/HTTPS_PROXYhttp_proxy/HTTP_PROXYall_proxy/ALL_PROXYno_proxy/NO_PROXY(to bypass proxy for specific hosts)PROXY_USERNAME/proxy_username(for separate proxy authentication)PROXY_PASSWORD/proxy_password(for separate proxy authentication)
Proxy authentication can be configured in two ways:
- Embedded in URL:
http://username:password@proxy:port(URL-encode special characters) - Separate parameters/variables:
proxy_usernameandproxy_password
Current behaviour
The v4 API clients do not support proxy configuration.
Expected behaviour
Users can configure proxy settings via module parameters or environment variables:
# Option 1: Via module parameters (recommended)
- name: VM playbook
hosts: localhost
module_defaults:
group/nutanix.ncp.ntnx:
nutanix_host: "{{ pc_ip }}"
nutanix_username: "{{ pc_username }}"
nutanix_password: "{{ pc_password }}"
validate_certs: false
https_proxy: "http://user:pass%40word@proxy.example.com:8080"
no_proxy: "localhost,127.0.0.1"
tasks:
- name: List VMs through proxy
nutanix.ncp.ntnx_vms_info_v2:
register: result# Option 2: Via shell export command with credentials in URL
export https_proxy="http://user:pass%40word@proxy.example.com:8080"
ansible-playbook your_playbook.yml# Option 3: Via shell export command with separate credentials
export HTTPS_PROXY="http://proxy.example.com:8080"
export PROXY_USERNAME="user"
export PROXY_PASSWORD="pass@word"
ansible-playbook your_playbook.yml# Option 4: Via environment key in playbook with credentials in URL
- name: VM playbook
hosts: localhost
vars:
proxy_env:
HTTPS_PROXY: "http://user:pass%40word@proxy.example.com:8080"
NO_PROXY: "localhost,127.0.0.1"
environment: "{{ proxy_env }}"
tasks:
- name: Create VM
nutanix.ncp.ntnx_vms_v2:
nutanix_host: "{{ pc_ip }}"
# ... other params# Option 5: Via environment key in playbook with separate credentials
- name: VM playbook
hosts: localhost
vars:
proxy_env:
HTTPS_PROXY: "http://proxy.example.com:8080"
PROXY_USERNAME: "user"
PROXY_PASSWORD: "pass@word"
NO_PROXY: "localhost,127.0.0.1"
environment: "{{ proxy_env }}"
tasks:
- name: Create VM
nutanix.ncp.ntnx_vms_v2:
nutanix_host: "{{ pc_ip }}"
# ... other paramsPrecedence:
- Configuration source: Module parameters > Playbook
environmentkey > Shellexportvariables - Proxy URL:
https_proxy>http_proxy>all_proxy(lowercase checked before uppercase variants) - Credentials: URL-embedded credentials take precedence over
proxy_username/proxy_passwordparameters/variables
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done