Skip to content

Commit ea3ecc8

Browse files
committed
Added custom certificate support
1 parent 9416330 commit ea3ecc8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

plugins/inventory/nb_inventory.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@
3535
- Allows connection when SSL certificates are not valid. Set to C(false) when certificates are not trusted.
3636
default: True
3737
type: boolean
38+
cert:
39+
description:
40+
- Certificate path
41+
default: False
42+
key:
43+
description:
44+
- Certificate key path
45+
default: False
46+
ca_path:
47+
description:
48+
- CA path
49+
default: False
3850
follow_redirects:
3951
description:
4052
- Determine how redirects are followed.
@@ -299,6 +311,9 @@ def _fetch_information(self, url):
299311
timeout=self.timeout,
300312
validate_certs=self.validate_certs,
301313
follow_redirects=self.follow_redirects,
314+
client_cert=self.cert,
315+
client_key=self.key,
316+
ca_path=self.ca_path,
302317
)
303318
except urllib_error.HTTPError as e:
304319
"""This will return the response body when we encounter an error.
@@ -1623,6 +1638,9 @@ def parse(self, inventory, loader, path, cache=True):
16231638
% (ansible_version, python_version.split(" ")[0]),
16241639
"Content-type": "application/json",
16251640
}
1641+
self.cert = self.get_option("cert")
1642+
self.key = self.get_option("key")
1643+
self.ca_path = self.get_option("ca_path")
16261644
if token:
16271645
self.headers.update({"Authorization": "Token %s" % token})
16281646

0 commit comments

Comments
 (0)