Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_vipgrp6.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_firewall_vipgrp6
15 short_description: Configure IPv6 virtual IP groups.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.full_crud
20 options:
21 revision_note:
22 description: The change note that can be specified when an object is created or updated.
23 type: str
24 adom:
25 description: The parameter (adom) in requested url.
26 type: str
27 required: true
28 firewall_vipgrp6:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 color:
34 type: int
35 description: Integer value to determine the color of the icon in the GUI
36 comments:
37 type: str
38 description: Comment.
39 member:
40 type: raw
41 description: (list or str) Member VIP objects of the group
42 name:
43 type: str
44 description: IPv6 VIP group name.
45 required: true
46 uuid:
47 type: str
48 description: Universally Unique Identifier
49 '''
50
51 EXAMPLES = '''
52 - name: Example playbook
53 hosts: fortimanagers
54 gather_facts: false
55 connection: httpapi
56 vars:
57 ansible_httpapi_use_ssl: true
58 ansible_httpapi_validate_certs: false
59 ansible_httpapi_port: 443
60 tasks:
61 - name: Configure IPv6 virtual IP groups.
62 fortinet.fortimanager.fmgr_firewall_vipgrp6:
63 bypass_validation: false
64 adom: ansible
65 state: present
66 firewall_vipgrp6:
67 color: 2
68 comments: "ansible-comment"
69 member: "ansible-test-vip6"
70 name: "ansible-test-vipgrp6"
71
72 - name: Gathering fortimanager facts
73 hosts: fortimanagers
74 gather_facts: false
75 connection: httpapi
76 vars:
77 ansible_httpapi_use_ssl: true
78 ansible_httpapi_validate_certs: false
79 ansible_httpapi_port: 443
80 tasks:
81 - name: Retrieve all the IPv6 virtual IP groups
82 fortinet.fortimanager.fmgr_fact:
83 facts:
84 selector: "firewall_vipgrp6"
85 params:
86 adom: "ansible"
87 vipgrp6: "your_value"
88 '''
89
90 RETURN = '''
91 meta:
92 description: The result of the request.
93 type: dict
94 returned: always
95 contains:
96 request_url:
97 description: The full url requested.
98 returned: always
99 type: str
100 sample: /sys/login/user
101 response_code:
102 description: The status of api request.
103 returned: always
104 type: int
105 sample: 0
106 response_data:
107 description: The api response.
108 type: list
109 returned: always
110 response_message:
111 description: The descriptive message of the api response.
112 type: str
113 returned: always
114 sample: OK.
115 system_information:
116 description: The information of the target system.
117 type: dict
118 returned: always
119 rc:
120 description: The status the request.
121 type: int
122 returned: always
123 sample: 0
124 version_check_warning:
125 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
126 type: list
127 returned: complex
128 '''
129 from ansible.module_utils.basic import AnsibleModule
130 from ansible.module_utils.connection import Connection
131 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
132 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
133
134
135 def main():
136 urls_list = [
137 '/pm/config/adom/{adom}/obj/firewall/vipgrp6',
138 '/pm/config/global/obj/firewall/vipgrp6'
139 ]
140 module_arg_spec = {
141 'adom': {'required': True, 'type': 'str'},
142 'revision_note': {'type': 'str'},
143 'firewall_vipgrp6': {
144 'type': 'dict', 'v_range': [['6.0.0', '']],
145 'options': {
146 'color': {'type': 'int'},
147 'comments': {'type': 'str'},
148 'member': {'type': 'raw'},
149 'name': {'required': True, 'type': 'str'},
150 'uuid': {'type': 'str'}
151 }
152 }
153 }
154
155 module_option_spec = get_module_arg_spec('full crud')
156 module_arg_spec.update(module_option_spec)
157 check_galaxy_version(module_arg_spec)
158 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_vipgrp6'),
159 supports_check_mode=True)
160 if not module._socket_path:
161 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
162 connection = Connection(module._socket_path)
163 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
164 'name', 'data', module, connection)
165 fmgr.process_crud()
166 module.exit_json(meta=module.params)
167
168
169 if __name__ == '__main__':
170 main()