Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_fips.py

raw symbols SCIP
1 #!/usr/bin/python
2 from __future__ import absolute_import, division, print_function
3 # Copyright 2019-2024 Fortinet, Inc.
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6 __metaclass__ = type
7
8 ANSIBLE_METADATA = {'status': ['preview'],
9 'supported_by': 'community',
10 'metadata_version': '1.1'}
11
12 DOCUMENTATION = '''
13 ---
14 module: fmgr_system_fips
15 short_description: Settings for FIPS-CC mode.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 system_fips:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 entropy_token:
27 aliases: ['entropy-token']
28 type: str
29 description:
30 - Enable/disable entropy token when switching to FIPS mode.
31 - enable - Enable entropy token.
32 - disable - Disable entropy token.
33 - dynamic - Dynamically detect entropy token during bootup.
34 choices: ['enable', 'disable', 'dynamic']
35 re_seed_interval:
36 aliases: ['re-seed-interval']
37 type: int
38 description: Kernel FIPS-compliant PRNG re-seed interval
39 status:
40 type: str
41 description:
42 - Enable/disable FIPS-CC mode.
43 - disable - Disable FIPS-CC mode.
44 - enable - Enable FIPS-CC mode.
45 choices: ['disable', 'enable']
46 '''
47
48 EXAMPLES = '''
49 - name: Example playbook (generated based on argument schema)
50 hosts: fortimanagers
51 connection: httpapi
52 gather_facts: false
53 tasks:
54 - name: Settings for FIPS-CC mode.
55 fortinet.fortimanager.fmgr_system_fips:
56 # workspace_locking_adom: <global or your adom name>
57 system_fips:
58 # entropy_token: <value in [enable, disable, dynamic]>
59 # re_seed_interval: <integer>
60 # status: <value in [disable, enable]>
61 '''
62
63 RETURN = '''
64 meta:
65 description: The result of the request.
66 type: dict
67 returned: always
68 contains:
69 request_url:
70 description: The full url requested.
71 returned: always
72 type: str
73 sample: /sys/login/user
74 response_code:
75 description: The status of api request.
76 returned: always
77 type: int
78 sample: 0
79 response_data:
80 description: The api response.
81 type: list
82 returned: always
83 response_message:
84 description: The descriptive message of the api response.
85 type: str
86 returned: always
87 sample: OK.
88 system_information:
89 description: The information of the target system.
90 type: dict
91 returned: always
92 rc:
93 description: The status the request.
94 type: int
95 returned: always
96 sample: 0
97 version_check_warning:
98 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
99 type: list
100 returned: complex
101 '''
102 from ansible.module_utils.basic import AnsibleModule
103 from ansible.module_utils.connection import Connection
104 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
105 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
106
107
108 def main():
109 urls_list = [
110 '/cli/global/system/fips'
111 ]
112 module_arg_spec = {
113 'system_fips': {
114 'type': 'dict', 'v_range': [['6.0.0', '']],
115 'options': {
116 'entropy-token': {'v_range': [['6.0.0', '7.6.3']], 'choices': ['enable', 'disable', 'dynamic'], 'type': 'str'},
117 're-seed-interval': {'v_range': [['6.0.0', '7.6.3']], 'type': 'int'},
118 'status': {'choices': ['disable', 'enable'], 'type': 'str'}
119 }
120 }
121 }
122
123 module_option_spec = get_module_arg_spec('partial crud')
124 module_arg_spec.update(module_option_spec)
125 check_galaxy_version(module_arg_spec)
126 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_fips'),
127 supports_check_mode=True)
128 if not module._socket_path:
129 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
130 connection = Connection(module._socket_path)
131 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
132 None, 'data', module, connection)
133 fmgr.process_partial_crud()
134 module.exit_json(meta=module.params)
135
136
137 if __name__ == '__main__':
138 main()