-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathcert_info.py
63 lines (48 loc) · 1.47 KB
/
cert_info.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2023, Daniel Patrick <[email protected]>
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or
# https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.module_utils.basic import (
AnsibleModule,
to_native
)
from ansible_collections.netways.elasticstack.plugins.module_utils.certs import (
AnalyzeCertificate
)
def run_module():
module_args = dict(
path=dict(type='str', no_log=True, required=True),
passphrase=dict(type='str', no_log=True, required=False, default=None),
passphrase_check=dict(type='bool', no_log=True, required=False, default=False)
)
# seed the result dict
result = dict(
changed=False,
extensions=dict(),
issuer='',
not_valid_after='',
not_valid_before='',
serial_number='',
subject='',
version='',
passphrase_check=True
)
# the AnsibleModule object
module = AnsibleModule(
argument_spec=module_args,
supports_check_mode=True
)
# check mode
if module.check_mode:
module.exit_json(**result)
cert_info = AnalyzeCertificate(module, result)
result = cert_info.return_result()
module.exit_json(**result)
def main():
run_module()
if __name__ == '__main__':
main()