Skip to content

vmware_vm_inventory does not use proxy if with_tags: true is set #1794

Closed
@DmitryGrayscale

Description

@DmitryGrayscale
SUMMARY

Once with_tags: true is used, inventory plugin can't connect to ESXi API since it does not use proxy specified in proxy_host:proxy_port.
Looks like it creates requests.Session object and does not set proxy:

session = requests.Session()

Could be something like

        if self.proxy_host:
            proxies = {
                'http': f'http://{self.proxy_host}:{self.proxy_port}',
                'https': f'http://{self.proxy_host}:{self.proxy_port}',
            }
            session.proxies.update(proxies)
ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.vmware.vmware_vm_inventory

ANSIBLE VERSION
ansible [core 2.13.10]
  config file = ansible/ansible.cfg
  configured module search path = ['.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = .local/lib/python3.10/site-packages/ansible
  ansible collection location =.ansible/collections:/usr/share/ansible/collections
  executable location = .local/bin/ansible
  python version = 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0]
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
Collection       Version
---------------- -------
community.vmware 3.7.0
CONFIGURATION

OS / ENVIRONMENT

Ubuntu22.04 under WSL2

STEPS TO REPRODUCE

set the following in inventory.vmware.yml file:

proxy_host: <host>
proxy_port: <port>
with_tags: true

run

ansible-inventory -i  inventory.vmware.yml --list

if set with_tags: false everything works as expected

EXPECTED RESULTS

the list of ESXi VMs

ACTUAL RESULTS
<!--- Describe what actually happened. If possible run with extra verbosity (-vvvv) -->
 Max retries exceeded with url: /api (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f9e6ebc7bb0>, 'Connection to x.x.x.x timed out. (connect
timeout=None)'))

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue/PR relates to a bugneeds_triageNeeds a first human triage before being processed.python3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions