mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
intersight_info has been moved to cisco.intersight. (#395)
This commit is contained in:
parent
f585aa065a
commit
7bb36d62d0
6 changed files with 0 additions and 122 deletions
|
@ -11,7 +11,6 @@ tags: null
|
|||
dependencies:
|
||||
ansible.netcommon: '>=0.1.0'
|
||||
ansible.posix: '>=0.1.0'
|
||||
cisco.intersight: '>=0.1.0'
|
||||
community.kubernetes: '>=0.1.0'
|
||||
google.cloud: '>=0.1.0'
|
||||
repository: https://github.com/ansible-collections/community.general
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
./remote_management/intersight/intersight_info.py
|
|
@ -1,114 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: intersight_info
|
||||
short_description: Gather information about Intersight
|
||||
description:
|
||||
- Gathers information about servers in L(Cisco Intersight,https://intersight.com).
|
||||
- This module was called C(intersight_facts) before Ansible 2.9. The usage did not change.
|
||||
extends_documentation_fragment:
|
||||
- cisco.intersight.intersight
|
||||
|
||||
options:
|
||||
server_names:
|
||||
description:
|
||||
- Server names to retrieve information from.
|
||||
- An empty list will return all servers.
|
||||
type: list
|
||||
required: yes
|
||||
author:
|
||||
- David Soper (@dsoper2)
|
||||
- CiscoUcs (@CiscoUcs)
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
- name: Get info for all servers
|
||||
intersight_info:
|
||||
api_private_key: ~/Downloads/SecretKey.txt
|
||||
api_key_id: 64612d300d0982/64612d300d0b00/64612d300d3650
|
||||
server_names:
|
||||
- debug:
|
||||
msg: "server name {{ item.Name }}, moid {{ item.Moid }}"
|
||||
loop: "{{ intersight_servers }}"
|
||||
when: intersight_servers is defined
|
||||
|
||||
- name: Get info for servers by name
|
||||
intersight_info:
|
||||
api_private_key: ~/Downloads/SecretKey.txt
|
||||
api_key_id: 64612d300d0982/64612d300d0b00/64612d300d3650
|
||||
server_names:
|
||||
- SJC18-L14-UCS1-1
|
||||
- debug:
|
||||
msg: "server moid {{ intersight_servers[0].Moid }}"
|
||||
when: intersight_servers[0] is defined
|
||||
'''
|
||||
|
||||
RETURN = r'''
|
||||
intersight_servers:
|
||||
description: A list of Intersight Servers. See L(Cisco Intersight,https://intersight.com/apidocs) for details.
|
||||
returned: always
|
||||
type: complex
|
||||
contains:
|
||||
Name:
|
||||
description: The name of the server.
|
||||
returned: always
|
||||
type: str
|
||||
sample: SJC18-L14-UCS1-1
|
||||
Moid:
|
||||
description: The unique identifier of this Managed Object instance.
|
||||
returned: always
|
||||
type: str
|
||||
sample: 5978bea36ad4b000018d63dc
|
||||
'''
|
||||
|
||||
from ansible_collections.cisco.intersight.plugins.module_utils.intersight import IntersightModule, intersight_argument_spec
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
def get_servers(module, intersight):
|
||||
query_list = []
|
||||
if module.params['server_names']:
|
||||
for server in module.params['server_names']:
|
||||
query_list.append("Name eq '%s'" % server)
|
||||
query_str = ' or '.join(query_list)
|
||||
options = {
|
||||
'http_method': 'get',
|
||||
'resource_path': '/compute/PhysicalSummaries',
|
||||
'query_params': {
|
||||
'$filter': query_str,
|
||||
'$top': 5000
|
||||
}
|
||||
}
|
||||
response_dict = intersight.call_api(**options)
|
||||
|
||||
return response_dict.get('Results')
|
||||
|
||||
|
||||
def main():
|
||||
argument_spec = intersight_argument_spec
|
||||
argument_spec.update(
|
||||
server_names=dict(type='list', required=True),
|
||||
)
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec,
|
||||
supports_check_mode=True,
|
||||
)
|
||||
if module._name in ('intersight_facts', 'community.general.intersight_facts'):
|
||||
module.deprecate("The 'intersight_facts' module has been renamed to 'intersight_info'", version='2.13')
|
||||
|
||||
intersight = IntersightModule(module)
|
||||
|
||||
# one API call returning all requested servers
|
||||
module.exit_json(intersight_servers=get_servers(module, intersight))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -6,8 +6,6 @@ integration_tests_dependencies:
|
|||
unit_tests_dependencies:
|
||||
- ansible.netcommon
|
||||
- ansible.posix
|
||||
- cisco.intersight
|
||||
- community.internal_test_tools
|
||||
- community.kubernetes
|
||||
- google.cloud
|
||||
- ovirt.ovirt
|
||||
|
|
|
@ -1400,8 +1400,6 @@ plugins/modules/remote_management/hpilo/hpilo_info.py pylint:collection-invalid-
|
|||
plugins/modules/remote_management/hpilo/hpilo_info.py validate-modules:parameter-type-not-in-doc
|
||||
plugins/modules/remote_management/hpilo/hponcfg.py validate-modules:parameter-type-not-in-doc
|
||||
plugins/modules/remote_management/imc/imc_rest.py validate-modules:parameter-type-not-in-doc
|
||||
plugins/modules/remote_management/intersight/intersight_info.py pylint:collection-invalid-deprecated-version
|
||||
plugins/modules/remote_management/intersight/intersight_info.py validate-modules:parameter-list-no-elements
|
||||
plugins/modules/remote_management/ipmi/ipmi_boot.py validate-modules:doc-choices-do-not-match-spec
|
||||
plugins/modules/remote_management/ipmi/ipmi_boot.py validate-modules:doc-missing-type
|
||||
plugins/modules/remote_management/ipmi/ipmi_boot.py validate-modules:parameter-type-not-in-doc
|
||||
|
|
|
@ -68,8 +68,6 @@ cd "${TEST_DIR}"
|
|||
# START: HACK install dependencies
|
||||
retry ansible-galaxy -vvv collection install ansible.netcommon
|
||||
retry ansible-galaxy -vvv collection install ansible.posix
|
||||
# https://github.com/CiscoDevNet/ansible-intersight/issues/9
|
||||
retry ansible-galaxy -vvv collection install cisco.intersight:1.0.4
|
||||
retry ansible-galaxy -vvv collection install community.crypto
|
||||
# retry ansible-galaxy -vvv collection install community.internal_test_tools - we need git checkout until 0.2.0 has been released
|
||||
retry git clone https://github.com/ansible-collections/community.internal_test_tools.git "${ANSIBLE_COLLECTIONS_PATHS}/ansible_collections/community/internal_test_tools"
|
||||
|
|
Loading…
Reference in a new issue