Debian Codegraph @

ansible_collections/cisco/intersight/plugins/modules/intersight_fibre_channel_adapter_policy_info.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6 from __future__ import absolute_import, division, print_function
7 __metaclass__ = type
8
9 ANSIBLE_METADATA = {'metadata_version': '1.1',
10 'status': ['preview'],
11 'supported_by': 'community'}
12
13 DOCUMENTATION = r'''
14 ---
15 module: intersight_fibre_channel_adapter_policy_info
16 short_description: Gather information about Fibre Channel Adapter Policies in Cisco Intersight
17 description:
18 - Retrieve information about Fibre Channel Adapter Policies from L(Cisco Intersight,https://intersight.com).
19 - Query policies by organization or policy name.
20 - Returns structured data with policy metadata and Fibre Channel Adapter configuration details.
21 - If no filters are provided, all Fibre Channel Adapter Policies will be returned.
22 extends_documentation_fragment: intersight
23 options:
24 organization:
25 description:
26 - The name of the organization to filter Fibre Channel Adapter Policies by.
27 - Use 'default' for the default organization.
28 - When specified, only policies from this organization will be returned.
29 type: str
30 name:
31 description:
32 - The exact name of the Fibre Channel Adapter Policy to retrieve information from.
33 - When specified, only the matching policy will be returned.
34 type: str
35 author:
36 - Ron Gershburg (@rgershbu)
37 '''
38
39 EXAMPLES = r'''
40 # Basic Usage Examples
41 - name: Fetch all Fibre Channel Adapter Policies from all organizations
42 cisco.intersight.intersight_fibre_channel_adapter_policy_info:
43 api_private_key: "{{ api_private_key }}"
44 api_key_id: "{{ api_key_id }}"
45 register: all_fc_adapter_policies
46
47 # Organization-specific Examples
48 - name: Fetch all Fibre Channel Adapter Policies from the default organization
49 cisco.intersight.intersight_fibre_channel_adapter_policy_info:
50 api_private_key: "{{ api_private_key }}"
51 api_key_id: "{{ api_key_id }}"
52 organization: "default"
53 register: default_org_policies
54
55 - name: Fetch all Fibre Channel Adapter Policies from a custom organization
56 cisco.intersight.intersight_fibre_channel_adapter_policy_info:
57 api_private_key: "{{ api_private_key }}"
58 api_key_id: "{{ api_key_id }}"
59 organization: "Engineering"
60 register: engineering_policies
61
62 # Specific Policy Examples
63 - name: Fetch a specific Fibre Channel Adapter Policy by name
64 cisco.intersight.intersight_fibre_channel_adapter_policy_info:
65 api_private_key: "{{ api_private_key }}"
66 api_key_id: "{{ api_key_id }}"
67 name: "fc-adapter-policy-01"
68 register: specific_policy
69
70 - name: Fetch a specific policy from a specific organization
71 cisco.intersight.intersight_fibre_channel_adapter_policy_info:
72 api_private_key: "{{ api_private_key }}"
73 api_key_id: "{{ api_key_id }}"
74 organization: "Production"
75 name: "fc-adapter-policy-prod"
76 register: specific_org_policy
77 '''
78
79 RETURN = r'''
80 api_response:
81 description:
82 - The API response containing Fibre Channel Adapter Policy information.
83 - Returns a list.
84 returned: always
85 type: list
86 sample:
87 [
88 {
89 "Name": "fc-adapter-policy-01",
90 "ObjectType": "vnic.FcAdapterPolicy",
91 "Moid": "1234567890abcdef12345678",
92 "Description": "Fibre Channel Adapter policy for production servers",
93 "ErrorRecoverySettings": {
94 "Enabled": true,
95 "PortDownTimeout": 5000,
96 "LinkDownTimeout": 20000,
97 "IoRetryTimeout": 8,
98 "IoRetryCount": 10
99 },
100 "ErrorDetectionTimeout": 5000,
101 "ResourceAllocationTimeout": 15000,
102 "FlogiSettings": {
103 "Retries": 12,
104 "Timeout": 8000
105 },
106 "PlogiSettings": {
107 "Retries": 12,
108 "Timeout": 30000
109 },
110 "InterruptSettings": {
111 "Mode": "MSIx"
112 },
113 "IoThrottleCount": 1024,
114 "LunCount": 4096,
115 "LunQueueDepth": 254,
116 "RxQueueSettings": {
117 "RingSize": 128
118 },
119 "TxQueueSettings": {
120 "RingSize": 128
121 },
122 "ScsiQueueSettings": {
123 "Count": 8,
124 "RingSize": 512
125 },
126 "Organization": {
127 "Name": "default",
128 "ObjectType": "organization.Organization",
129 "Moid": "abcdef1234567890abcdef12"
130 },
131 "Tags": [
132 {
133 "Key": "Environment",
134 "Value": "Production"
135 },
136 {
137 "Key": "Owner",
138 "Value": "Storage-Team"
139 }
140 ]
141 }
142 ]
143 '''
144
145
146 from ansible.module_utils.basic import AnsibleModule
147 from ansible_collections.cisco.intersight.plugins.module_utils.intersight import IntersightModule, intersight_argument_spec
148
149
150 def main():
151 argument_spec = intersight_argument_spec.copy()
152 argument_spec.update(
153 organization=dict(type='str'),
154 name=dict(type='str')
155 )
156 module = AnsibleModule(
157 argument_spec,
158 supports_check_mode=True,
159 )
160 intersight = IntersightModule(module)
161 intersight.result['api_response'] = {}
162 intersight.result['trace_id'] = ''
163
164 # Resource path used to fetch policy info
165 resource_path = '/vnic/FcAdapterPolicies'
166
167 # Get query parameters for policies
168 query_params = intersight.set_query_params()
169
170 # Get Fibre Channel Adapter policies
171 intersight.get_resource(
172 resource_path=resource_path,
173 query_params=query_params,
174 return_list=True
175 )
176 module.exit_json(**intersight.result)
177
178
179 if __name__ == '__main__':
180 main()