Fixed the ssl-certs in netbox plugin (#46543)
* Fixed the ssl-certs in netbox plugin * Added validate_certs parameter and updated the example
This commit is contained in:
parent
8a7a819040
commit
539f0fee09
1 changed files with 3 additions and 1 deletions
|
@ -71,6 +71,7 @@ EXAMPLES = '''
|
|||
|
||||
plugin: netbox
|
||||
api_endpoint: http://localhost:8000
|
||||
validate_certs: True
|
||||
group_by:
|
||||
- device_roles
|
||||
query_filters:
|
||||
|
@ -152,7 +153,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
|||
NAME = 'netbox'
|
||||
|
||||
def _fetch_information(self, url):
|
||||
response = open_url(url, headers=self.headers, timeout=self.timeout)
|
||||
response = open_url(url, headers=self.headers, timeout=self.timeout, validate_certs=self.validate_certs)
|
||||
|
||||
try:
|
||||
raw_data = to_text(response.read(), errors='surrogate_or_strict')
|
||||
|
@ -427,6 +428,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
|||
token = self.get_option("token")
|
||||
self.api_endpoint = self.get_option("api_endpoint")
|
||||
self.timeout = self.get_option("timeout")
|
||||
self.validate_certs = self.get_option("validate_certs")
|
||||
self.headers = {
|
||||
'Authorization': "Token %s" % token,
|
||||
'User-Agent': "ansible %s Python %s" % (ansible_version, python_version.split(' ')[0]),
|
||||
|
|
Loading…
Reference in a new issue