Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DmitryGrayscale opened this issue Jul 15, 2023 · 2 comments · May be fixed by #1801
Open

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

DmitryGrayscale opened this issue Jul 15, 2023 · 2 comments · May be fixed by #1801
Labels
bug This issue/PR relates to a bug needs_triage Needs a first human triage before being processed. python3

Comments

@DmitryGrayscale
Copy link

DmitryGrayscale commented Jul 15, 2023

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)'))
@ansibullbot
Copy link

Files identified in the description:
None

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link

@DmitryGrayscale: Greetings! Thanks for taking the time to open this issue. In order for the community to handle your issue effectively, we need a bit more information.

Here are the items we could not find in your description:

  • issue type
  • ansible version
  • component name

Please set the description of this issue with this template:
https://raw.githubusercontent.com/ansible/ansible/devel/.github/ISSUE_TEMPLATE/bug_report.md

click here for bot help

@ansibullbot ansibullbot added needs_info This issue requires further information. Please answer any outstanding questions needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly needs_triage Needs a first human triage before being processed. bug This issue/PR relates to a bug python3 and removed needs_info This issue requires further information. Please answer any outstanding questions needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly labels Jul 15, 2023
@DmitryGrayscale DmitryGrayscale linked a pull request Jul 18, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug needs_triage Needs a first human triage before being processed. python3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants