From 539f0fee09d9f2e17f8931d6d7638ee89e0939b7 Mon Sep 17 00:00:00 2001 From: nikkytub Date: Wed, 17 Oct 2018 22:30:47 +0200 Subject: [PATCH] Fixed the ssl-certs in netbox plugin (#46543) * Fixed the ssl-certs in netbox plugin * Added validate_certs parameter and updated the example --- lib/ansible/plugins/inventory/netbox.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/plugins/inventory/netbox.py b/lib/ansible/plugins/inventory/netbox.py index 02efd9633d..ab6447756d 100644 --- a/lib/ansible/plugins/inventory/netbox.py +++ b/lib/ansible/plugins/inventory/netbox.py @@ -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]),