On this page
cisco.ucs.ucs_query – Queries UCS Manager objects by class or distinguished name
Note
This plugin is part of the cisco.ucs collection (version 1.6.0).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install cisco.ucs.
To use it in a playbook, specify: cisco.ucs.ucs_query.
New in version 2.8: of cisco.ucs
Synopsis
- -Queries UCS Manager objects by class or distinguished name.
 
Requirements
The below requirements are needed on the host that executes this module.
- ucsmsdk
 
Parameters
| Parameter | Choices/Defaults | Comments | 
|---|---|---|
| class_ids
        
        string
         | 
      
        
        One or more UCS Manager Class IDs to query.
        
       
        As a comma separated list
         | 
     |
| delegate_to
        
        string
         | 
      Default: 
        "localhost"
         | 
      
        
        Where the module will be run
         | 
     
| distinguished_names
        
        string
         | 
      
        
        One or more UCS Manager Distinguished Names to query.
        
       
        As a comma separated list
         | 
     |
| hostname
        
        string / required
         | 
      
        
        IP address or hostname of Cisco UCS Manager.
        
       
        Modules can be used with the UCS Platform Emulator https://cs.co/ucspe
         | 
     |
| password
        
        string / required
         | 
      
        
        Password for Cisco UCS Manager authentication.
         | 
     |
| port
        
        integer
         | 
      
        
        Port number to be used during connection (by default uses 443 for https and 80 for http connection).
         | 
     |
| proxy
        
        string
         | 
      
        
        If use_proxy is no, specfies proxy to be used for connection. e.g. 'http://proxy.xy.z:8080'
         | 
     |
| use_proxy
        
        boolean
         | 
      
       
  | 
      
        
        If  no, will not use the proxy as defined by system environment variable.
        | 
     
| use_ssl
        
        boolean
         | 
      
       
  | 
      
        
        If  no, an HTTP connection will be used instead of the default HTTPS connection.
        | 
     
| username
        
        string
         | 
      Default: 
        "admin"
         | 
      
        
        Username for Cisco UCS Manager authentication.
         | 
     
Examples
- name: Query UCS Class ID
  cisco.ucs.ucs_query:
    hostname: "{{ ucs_hostname }}"
    username: "{{ ucs_username }}"
    password: "{{ ucs_password }}"
    class_ids: computeBlade
    delegate_to: localhost
- name: Query UCS Class IDs
  cisco.ucs.ucs_query:
    hostname: "{{ ucs_hostname }}"
    username: "{{ ucs_username }}"
    password: "{{ ucs_password }}"
    class_ids: computeBlade, fabricVlan
    delegate_to: localhost
- name: Query UCS Distinguished Name
  cisco.ucs.ucs_query:
    hostname: "{{ ucs_hostname }}"
    username: "{{ ucs_username }}"
    password: "{{ ucs_password }}"
    distinguished_names: org-root
    delegate_to: localhost
- name: Query UCS Distinguished Names
  cisco.ucs.ucs_query:
    hostname: "{{ ucs_hostname }}"
    username: "{{ ucs_username }}"
    password: "{{ ucs_password }}"
    distinguished_names: org-root, sys/rack-unit-1, sys/chassis-1/blade-2
    delegate_to: localhost
  Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | 
|---|---|---|
| objects
        
        dictionary
         | 
      success | 
        
        results JSON encodded
          | 
     
Authors
- John McDonough (@movinalot)
 - CiscoUcs (@CiscoUcs)
 
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
 https://docs.ansible.com/ansible/latest/collections/cisco/ucs/ucs_query_module.html