Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_interface_ipv6.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_interface_ipv6
15 short_description: IPv6 of interface.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 interface:
22 description: The parameter (interface) in requested url.
23 type: str
24 required: true
25 system_interface_ipv6:
26 description: The top level parameters set.
27 required: false
28 type: dict
29 suboptions:
30 ip6_address:
31 aliases: ['ip6-address']
32 type: str
33 description: IPv6 address/prefix of interface.
34 ip6_allowaccess:
35 aliases: ['ip6-allowaccess']
36 type: list
37 elements: str
38 description:
39 - Allow management access to interface.
40 - ping - PING access.
41 - https - HTTPS access.
42 - ssh - SSH access.
43 - snmp - SNMP access.
44 - http - HTTP access.
45 - webservice - Web service access.
46 - https-logging - Logging over HTTPS access.
47 choices: ['ping', 'https', 'ssh', 'snmp', 'http', 'webservice', 'https-logging',
48 'fabric']
49 ip6_autoconf:
50 aliases: ['ip6-autoconf']
51 type: str
52 description:
53 - Enable/disable address auto config
54 - disable - Disable setting.
55 - enable - Enable setting.
56 choices: ['disable', 'enable']
57 '''
58
59 EXAMPLES = '''
60 - name: Example playbook (generated based on argument schema)
61 hosts: fortimanagers
62 connection: httpapi
63 gather_facts: false
64 tasks:
65 - name: IPv6 of interface.
66 fortinet.fortimanager.fmgr_system_interface_ipv6:
67 # workspace_locking_adom: <global or your adom name>
68 interface: <your own value>
69 system_interface_ipv6:
70 # ip6_address: <string>
71 # ip6_allowaccess: ["ping", "https", "ssh", "snmp", "http", "webservice",
72 # "https-logging", "fabric"]
73 # ip6_autoconf: <value in [disable, enable]>
74 '''
75
76 RETURN = '''
77 meta:
78 description: The result of the request.
79 type: dict
80 returned: always
81 contains:
82 request_url:
83 description: The full url requested.
84 returned: always
85 type: str
86 sample: /sys/login/user
87 response_code:
88 description: The status of api request.
89 returned: always
90 type: int
91 sample: 0
92 response_data:
93 description: The api response.
94 type: list
95 returned: always
96 response_message:
97 description: The descriptive message of the api response.
98 type: str
99 returned: always
100 sample: OK.
101 system_information:
102 description: The information of the target system.
103 type: dict
104 returned: always
105 rc:
106 description: The status the request.
107 type: int
108 returned: always
109 sample: 0
110 version_check_warning:
111 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
112 type: list
113 returned: complex
114 '''
115 from ansible.module_utils.basic import AnsibleModule
116 from ansible.module_utils.connection import Connection
117 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
118 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
119
120
121 def main():
122 urls_list = [
123 '/cli/global/system/interface/{interface}/ipv6'
124 ]
125 module_arg_spec = {
126 'interface': {'required': True, 'type': 'str'},
127 'system_interface_ipv6': {
128 'type': 'dict', 'v_range': [['6.0.0', '']],
129 'options': {
130 'ip6-address': {'type': 'str'},
131 'ip6-allowaccess': {
132 'type': 'list',
133 'choices': ['ping', 'https', 'ssh', 'snmp', 'http', 'webservice', 'https-logging', 'fabric'],
134 'elements': 'str'
135 },
136 'ip6-autoconf': {'choices': ['disable', 'enable'], 'type': 'str'}
137 }
138 }
139 }
140
141 module_option_spec = get_module_arg_spec('partial crud')
142 module_arg_spec.update(module_option_spec)
143 check_galaxy_version(module_arg_spec)
144 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_interface_ipv6'),
145 supports_check_mode=True)
146 if not module._socket_path:
147 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
148 connection = Connection(module._socket_path)
149 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
150 None, 'data', module, connection)
151 fmgr.process_partial_crud()
152 module.exit_json(meta=module.params)
153
154
155 if __name__ == '__main__':
156 main()