Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_route6.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_route6
15 short_description: Routing table configuration.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.full_crud
20 options:
21 system_route6:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 device:
27 type: str
28 description: Gateway out interface.
29 dst:
30 type: str
31 description: Destination IP and mask for this route.
32 gateway:
33 type: str
34 description: Gateway IP for this route.
35 prio:
36 type: int
37 description: Entry number.
38 required: true
39 '''
40
41 EXAMPLES = '''
42 - name: Example playbook
43 hosts: fortimanagers
44 gather_facts: false
45 connection: httpapi
46 vars:
47 ansible_httpapi_use_ssl: true
48 ansible_httpapi_validate_certs: false
49 ansible_httpapi_port: 443
50 tasks:
51 - name: Routing table configuration.
52 fortinet.fortimanager.fmgr_system_route6:
53 bypass_validation: false
54 state: present
55 system_route6:
56 device: port1
57 dst: "2001::/96"
58 gateway: 2001::2
59 prio: 2
60
61 - name: Gathering fortimanager facts
62 hosts: fortimanagers
63 gather_facts: false
64 connection: httpapi
65 vars:
66 ansible_httpapi_use_ssl: true
67 ansible_httpapi_validate_certs: false
68 ansible_httpapi_port: 443
69 tasks:
70 - name: Retrieve all the IPv6 routing tables
71 fortinet.fortimanager.fmgr_fact:
72 facts:
73 selector: "system_route6"
74 params:
75 route6: "your_value"
76 '''
77
78 RETURN = '''
79 meta:
80 description: The result of the request.
81 type: dict
82 returned: always
83 contains:
84 request_url:
85 description: The full url requested.
86 returned: always
87 type: str
88 sample: /sys/login/user
89 response_code:
90 description: The status of api request.
91 returned: always
92 type: int
93 sample: 0
94 response_data:
95 description: The api response.
96 type: list
97 returned: always
98 response_message:
99 description: The descriptive message of the api response.
100 type: str
101 returned: always
102 sample: OK.
103 system_information:
104 description: The information of the target system.
105 type: dict
106 returned: always
107 rc:
108 description: The status the request.
109 type: int
110 returned: always
111 sample: 0
112 version_check_warning:
113 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
114 type: list
115 returned: complex
116 '''
117 from ansible.module_utils.basic import AnsibleModule
118 from ansible.module_utils.connection import Connection
119 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
120 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
121
122
123 def main():
124 urls_list = [
125 '/cli/global/system/route6'
126 ]
127 module_arg_spec = {
128 'system_route6': {
129 'type': 'dict', 'v_range': [['6.0.0', '']],
130 'options': {'device': {'type': 'str'}, 'dst': {'type': 'str'}, 'gateway': {'type': 'str'}, 'prio': {'required': True, 'type': 'int'}}
131 }
132 }
133
134 module_option_spec = get_module_arg_spec('full crud')
135 module_arg_spec.update(module_option_spec)
136 check_galaxy_version(module_arg_spec)
137 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_route6'),
138 supports_check_mode=True)
139 if not module._socket_path:
140 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
141 connection = Connection(module._socket_path)
142 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
143 'prio', 'data', module, connection)
144 fmgr.process_crud()
145 module.exit_json(meta=module.params)
146
147
148 if __name__ == '__main__':
149 main()