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

INFOBLOX_HTTP_REQUEST_TIMEOUT cannot be an environmental variable #185

Open
mrfito opened this issue May 5, 2023 · 2 comments
Open

INFOBLOX_HTTP_REQUEST_TIMEOUT cannot be an environmental variable #185

mrfito opened this issue May 5, 2023 · 2 comments

Comments

@mrfito
Copy link

mrfito commented May 5, 2023

I am trying to use the inventory plugin connected to our infoblox device. I issue this command
$ ansible-inventory --list -i infoblox.yaml
and I expect to get a list of all the hosts in my infoblox device but I guess this instead
[WARNING]: * Failed to parse /home/infoblox.yaml with auto plugin: Infoblox HTTP request failed with: HTTPSConnectionPool(host='myhost.mydomain.com', port=443): Max retries exceeded with url: /wapi/v2.1/record%3Ahost?_return_fields=name%2Cview%2Cextattrs%2Cipv4addrs&_max_results=1000 (Caused by ReadTimeoutError("HTTPSConnectionPool(host='myhost.mydomain.com', port=443): Read timed out. (read timeout=10)",)) [WARNING]: * Failed to parse /home/infoblox.yaml with yaml plugin: Plugin configuration YAML file, not YAML inventory [WARNING]: * Failed to parse /home/infoblox.yaml with ini plugin: Invalid host pattern 'plugin:' supplied, ending in ':' is not allowed, this character is reserved to provide a port. [WARNING]: Unable to parse /home/infoblox.yaml as an inventory source [WARNING]: No inventory was parsed, only implicit localhost is available { "_meta": { "hostvars": {} }, "all": { "children": [ "ungrouped" ] } }

This error tells me that the infoblox device doesn't answer fast enough. Looking at the repo I find the file
plugins/module_utils/api.py
'http_request_timeout': dict(type='int', default=10, fallback=(env_fallback, ['INFOBLOX_HTTP_REQUEST_TIMEOUT'])),

So then I tried to set the environment variable
$ export INFOBLOX_HTTP_REQUEST_TIMEOUT=20
expecting to increase the timeout and then run
$ ansible-inventory --list -i infoblox.yaml

but instead of getting the list of hosts I get
[WARNING]: * Failed to parse /home/infoblox.yaml with auto plugin: Timeout value connect was 20, but it must be an int, float or None. [WARNING]: * Failed to parse /home/infoblox.yaml with yaml plugin: Plugin configuration YAML file, not YAML inventory [WARNING]: * Failed to parse /home/infoblox.yaml with ini plugin: Invalid host pattern 'plugin:' supplied, ending in ':' is not allowed, this character is reserved to provide a port. [WARNING]: Unable to parse /home/infoblox.yaml as an inventory source [WARNING]: No inventory was parsed, only implicit localhost is available { "_meta": { "hostvars": {} }, "all": { "children": [ "ungrouped" ] } }

It seems environmental variables are always strings so the inventory plugin should convert the env into a string. Am I wrong?

I know that my set up has all requirements and it is set up correctly because if I modified plugins/module_utils/api.py to have a timeout of 20
'http_request_timeout': dict(type='int', default=20, fallback=(env_fallback, ['INFOBLOX_HTTP_REQUEST_TIMEOUT'])),
and then I can successfully run
$ ansible-inventory --list -i infoblox.yaml
and I get the list of all hosts in our infoblox device.

In the meantime, is there a workaround that doesn't involve modifying apy.py?

@hemanthKa677
Copy link
Collaborator

Hi @mrfito, Could you please share the yaml data from infoblox.yaml ? So that, I will test on my end to fix the issue.

@mrfito
Copy link
Author

mrfito commented May 22, 2023

Hi @hemanthKa677
I failed to see how the contents of the infoblox.yaml will help but here you are. Please let me know if you need anything else.
Thanks,
Rodolfo

`# This file provides the configuration information for the Infoblox dynamic

inventory script that is used to dynamically pull host information from NIOS.

plugin: infoblox.nios_modules.nios_inventory
host: myhost.mydoamin.com
username: admin
password: OurSecretPassword

hostfilter:
`

JkhatriInfobox added a commit to JkhatriInfobox/infoblox-ansible that referenced this issue Dec 12, 2023
JkhatriInfobox added a commit that referenced this issue Dec 12, 2023
* Fixed LBDN and Pool Object for transform fields
[FIX] LBDN: auth_zone and pool field
[FIX] POOL: servers and monitors field

* Fixed BUGS for ENV Variables wapi_version and max_results

BUG #198
BUG #185

* Resolve Issue #116
[ADD] Version to infoblox-client in requirement.txt
matthewdennett pushed a commit to matthewdennett/infoblox-ansible that referenced this issue May 28, 2024
* Fixed LBDN and Pool Object for transform fields
[FIX] LBDN: auth_zone and pool field
[FIX] POOL: servers and monitors field

* Fixed BUGS for ENV Variables wapi_version and max_results

BUG infobloxopen#198
BUG infobloxopen#185

* Resolve Issue infobloxopen#116
[ADD] Version to infoblox-client in requirement.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants