| 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_ethernet_adapter_policy_info |
| 16 |
short_description: Gather information about Ethernet Adapter Policies in Cisco Intersight |
| 17 |
description: |
| 18 |
- Gather information about Ethernet Adapter Policies in L(Cisco Intersight,https://intersight.com). |
| 19 |
- Information can be filtered by O(organization) and O(name). |
| 20 |
- If no filters are passed, all Ethernet Adapter Policies will be returned. |
| 21 |
- Returns comprehensive policy configuration including VXLAN, NVGRE, ARFS, PTP, RoCE, queue settings, and offload configurations. |
| 22 |
extends_documentation_fragment: intersight |
| 23 |
options: |
| 24 |
organization: |
| 25 |
description: |
| 26 |
- The name of the organization the Ethernet Adapter Policy belongs to. |
| 27 |
- Use 'default' for the default organization. |
| 28 |
type: str |
| 29 |
name: |
| 30 |
description: |
| 31 |
- The name of the Ethernet Adapter Policy to gather information from. |
| 32 |
type: str |
| 33 |
author: |
| 34 |
- Ron Gershburg (@rgershbu) |
| 35 |
''' |
| 36 |
|
| 37 |
EXAMPLES = r''' |
| 38 |
- name: Fetch all Ethernet Adapter Policies |
| 39 |
cisco.intersight.intersight_ethernet_adapter_policy_info: |
| 40 |
api_private_key: "{{ api_private_key }}" |
| 41 |
api_key_id: "{{ api_key_id }}" |
| 42 |
register: all_adapter_policies |
| 43 |
|
| 44 |
- name: Fetch Ethernet Adapter Policies from a specific organization |
| 45 |
cisco.intersight.intersight_ethernet_adapter_policy_info: |
| 46 |
api_private_key: "{{ api_private_key }}" |
| 47 |
api_key_id: "{{ api_key_id }}" |
| 48 |
organization: "Engineering" |
| 49 |
register: engineering_adapter_policies |
| 50 |
|
| 51 |
- name: Fetch a specific Ethernet Adapter Policy by name |
| 52 |
cisco.intersight.intersight_ethernet_adapter_policy_info: |
| 53 |
api_private_key: "{{ api_private_key }}" |
| 54 |
api_key_id: "{{ api_key_id }}" |
| 55 |
name: "high-performance-adapter-policy" |
| 56 |
register: specific_adapter_policy |
| 57 |
''' |
| 58 |
|
| 59 |
RETURN = r''' |
| 60 |
api_response: |
| 61 |
description: The API response output returned by the specified resource. |
| 62 |
returned: always |
| 63 |
type: list |
| 64 |
sample: |
| 65 |
[ |
| 66 |
{ |
| 67 |
"Moid": "6889f3e8f654d9f7013baae4", |
| 68 |
"ObjectType": "vnic.EthAdapterPolicy", |
| 69 |
"ClassId": "vnic.EthAdapterPolicy", |
| 70 |
"Name": "high-performance-adapter-policy", |
| 71 |
"Description": "High performance Ethernet adapter policy", |
| 72 |
"AdvancedFilter": true, |
| 73 |
"ArfsSettings": { |
| 74 |
"ClassId": "vnic.ArfsSettings", |
| 75 |
"ObjectType": "vnic.ArfsSettings", |
| 76 |
"Enabled": true |
| 77 |
}, |
| 78 |
"CompletionQueueSettings": { |
| 79 |
"ClassId": "vnic.CompletionQueueSettings", |
| 80 |
"ObjectType": "vnic.CompletionQueueSettings", |
| 81 |
"Count": 12, |
| 82 |
"RingSize": 1 |
| 83 |
}, |
| 84 |
"EtherChannelPinningEnabled": false, |
| 85 |
"GeneveEnabled": false, |
| 86 |
"InterruptScaling": true, |
| 87 |
"InterruptSettings": { |
| 88 |
"ClassId": "vnic.EthInterruptSettings", |
| 89 |
"ObjectType": "vnic.EthInterruptSettings", |
| 90 |
"CoalescingTime": 125, |
| 91 |
"CoalescingType": "MIN", |
| 92 |
"Count": 16, |
| 93 |
"Mode": "MSIx" |
| 94 |
}, |
| 95 |
"NvgreSettings": { |
| 96 |
"ClassId": "vnic.NvgreSettings", |
| 97 |
"ObjectType": "vnic.NvgreSettings", |
| 98 |
"Enabled": false |
| 99 |
}, |
| 100 |
"PtpSettings": { |
| 101 |
"ClassId": "vnic.PtpSettings", |
| 102 |
"ObjectType": "vnic.PtpSettings", |
| 103 |
"Enabled": true |
| 104 |
}, |
| 105 |
"RoceSettings": { |
| 106 |
"ClassId": "vnic.RoceSettings", |
| 107 |
"ObjectType": "vnic.RoceSettings", |
| 108 |
"ClassOfService": 5, |
| 109 |
"Enabled": true, |
| 110 |
"MemoryRegions": 131072, |
| 111 |
"QueuePairs": 256, |
| 112 |
"ResourceGroups": 2, |
| 113 |
"Version": 2 |
| 114 |
}, |
| 115 |
"RssHashSettings": { |
| 116 |
"ClassId": "vnic.RssHashSettings", |
| 117 |
"ObjectType": "vnic.RssHashSettings", |
| 118 |
"Ipv4Hash": true, |
| 119 |
"Ipv6ExtHash": false, |
| 120 |
"Ipv6Hash": true, |
| 121 |
"TcpIpv4Hash": true, |
| 122 |
"TcpIpv6ExtHash": false, |
| 123 |
"TcpIpv6Hash": true, |
| 124 |
"UdpIpv4Hash": false, |
| 125 |
"UdpIpv6Hash": false |
| 126 |
}, |
| 127 |
"RssSettings": true, |
| 128 |
"RxQueueSettings": { |
| 129 |
"ClassId": "vnic.EthRxQueueSettings", |
| 130 |
"ObjectType": "vnic.EthRxQueueSettings", |
| 131 |
"Count": 8, |
| 132 |
"RingSize": 512 |
| 133 |
}, |
| 134 |
"TcpOffloadSettings": { |
| 135 |
"ClassId": "vnic.TcpOffloadSettings", |
| 136 |
"ObjectType": "vnic.TcpOffloadSettings", |
| 137 |
"LargeReceive": true, |
| 138 |
"LargeSend": true, |
| 139 |
"RxChecksum": true, |
| 140 |
"TxChecksum": true |
| 141 |
}, |
| 142 |
"TxQueueSettings": { |
| 143 |
"ClassId": "vnic.EthTxQueueSettings", |
| 144 |
"ObjectType": "vnic.EthTxQueueSettings", |
| 145 |
"Count": 4, |
| 146 |
"RingSize": 256 |
| 147 |
}, |
| 148 |
"UplinkFailbackTimeout": 5, |
| 149 |
"VxlanSettings": { |
| 150 |
"ClassId": "vnic.VxlanSettings", |
| 151 |
"ObjectType": "vnic.VxlanSettings", |
| 152 |
"Enabled": true |
| 153 |
}, |
| 154 |
"Organization": { |
| 155 |
"ObjectType": "organization.Organization", |
| 156 |
"ClassId": "mo.MoRef", |
| 157 |
"Moid": "675450ee69726530014753e2", |
| 158 |
"link": "https://us-east-1.intersight.com/api/v1/organization/Organizations/675450ee69726530014753e2" |
| 159 |
}, |
| 160 |
"Tags": [ |
| 161 |
{ |
| 162 |
"Key": "Environment", |
| 163 |
"Value": "Production" |
| 164 |
}, |
| 165 |
{ |
| 166 |
"Key": "Feature", |
| 167 |
"Value": "HighPerformance" |
| 168 |
} |
| 169 |
] |
| 170 |
} |
| 171 |
] |
| 172 |
''' |
| 173 |
|
| 174 |
|
| 175 |
from ansible.module_utils.basic import AnsibleModule |
| 176 |
from ansible_collections.cisco.intersight.plugins.module_utils.intersight import IntersightModule, intersight_argument_spec |
| 177 |
|
| 178 |
|
| 179 |
def main(): |
| 180 |
argument_spec = intersight_argument_spec.copy() |
| 181 |
argument_spec.update( |
| 182 |
organization=dict(type='str'), |
| 183 |
name=dict(type='str') |
| 184 |
) |
| 185 |
module = AnsibleModule( |
| 186 |
argument_spec, |
| 187 |
supports_check_mode=True, |
| 188 |
) |
| 189 |
|
| 190 |
intersight = IntersightModule(module) |
| 191 |
intersight.result['api_response'] = {} |
| 192 |
intersight.result['trace_id'] = '' |
| 193 |
|
| 194 |
# Resource path used to fetch info |
| 195 |
resource_path = '/vnic/EthAdapterPolicies' |
| 196 |
|
| 197 |
query_params = intersight.set_query_params() |
| 198 |
|
| 199 |
intersight.get_resource( |
| 200 |
resource_path=resource_path, |
| 201 |
query_params=query_params, |
| 202 |
return_list=True |
| 203 |
) |
| 204 |
|
| 205 |
module.exit_json(**intersight.result) |
| 206 |
|
| 207 |
|
| 208 |
if __name__ == '__main__': |
| 209 |
main() |