ansible.builtin.ucs_managed_objects (v2.9.0) — module

Configures Managed Objects on Cisco UCS Manager

| "added in version" 2.8 of ansible.builtin"

Authors: David Soper (@dsoper2), CiscoUcs (@CiscoUcs)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.0

Description

Configures Managed Objects on Cisco UCS Manager.

The Python SDK module, Python class within the module (UCSM Class), and all properties must be directly specified.

More information on the UCSM Python SDK and how to directly configure Managed Objects is available at L(UCSM Python SDK,http://ucsmsdk.readthedocs.io/).

Examples can be used with the UCS Platform Emulator U(https://communities.cisco.com/ucspe).


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure Network Control Policy
  ucs_managed_objects:
    hostname: 172.16.143.150
    username: admin
    password: password
    objects:
    - module: ucsmsdk.mometa.nwctrl.NwctrlDefinition
      class: NwctrlDefinition
      properties:
        parent_mo_or_dn: org-root
        cdp: enabled
        descr: ''
        lldp_receive: enabled
        lldp_transmit: enabled
        name: Enable-CDP-LLDP
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove Network Control Policy
  ucs_managed_objects:
    hostname: 172.16.143.150
    username: admin
    password: password
    objects:
    - module: ucsmsdk.mometa.nwctrl.NwctrlDefinition
      class: NwctrlDefinition
      properties:
        parent_mo_or_dn: org-root
        name: Enable-CDP-LLDP
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure Boot Policy Using JSON objects list with children
  ucs_managed_objects:
    hostname: 172.16.143.150
    username: admin
    password: password
    objects:
    - {
          "module": "ucsmsdk.mometa.lsboot.LsbootPolicy",
          "class": "LsbootPolicy",
          "properties": {
              "parent_mo_or_dn": "org-root",
              "name": "Python_SDS",
              "enforce_vnic_name": "yes",
              "boot_mode": "legacy",
              "reboot_on_update": "no"
          },
          "children": [
              {
                  "module": "ucsmsdk.mometa.lsboot.LsbootVirtualMedia",
                  "class": "LsbootVirtualMedia",
                  "properties": {
                      "access": "read-only-local",
                      "lun_id": "0",
                      "order": "2"
                  }
              },
              {
                  "module": "ucsmsdk.mometa.lsboot.LsbootStorage",
                  "class": "LsbootStorage",
                  "properties": {
                      "order": "1"
                  },
                  "children": [
                      {
                          "module": "ucsmsdk.mometa.lsboot.LsbootLocalStorage",
                          "class": "LsbootLocalStorage",
                          "properties": {},
                          "children": [
                              {
                                  "module": "ucsmsdk.mometa.lsboot.LsbootDefaultLocalImage",
                                  "class": "LsbootDefaultLocalImage",
                                  "properties": {
                                      "order": "1"
                                  }
                              }
                          ]
                      }
                  ]
              }
          ]
      }
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove Boot Policy Using JSON objects list
  ucs_managed_objects:
    hostname: 172.16.143.150
    username: admin
    password: password
    objects:
    - {
          "module": "ucsmsdk.mometa.lsboot.LsbootPolicy",
          "class": "LsbootPolicy",
          "properties": {
              "parent_mo_or_dn": "org-root",
              "name": "Python_SDS"
          }
      }
    state: absent

Inputs

    
port:
    description:
    - Port number to be used during connection (by default uses 443 for https and 80 for
      http connection).
    type: int

proxy:
    description:
    - If use_proxy is no, specfies proxy to be used for connection. e.g. 'http://proxy.xy.z:8080'
    type: str

state:
    choices:
    - absent
    - present
    default: present
    description:
    - If C(present), will verify that the Managed Objects are present and will create
      if needed.
    - If C(absent), will verify that the Managed Objects are absent and will delete if
      needed.

objects:
    description:
    - List of managed objects to configure.  Each managed object has suboptions the specify
      the Python SDK module, class, and properties to configure.
    required: true
    suboptions:
      children:
        description:
        - Optional list of child objects.  Each child has its own module, class, and properties
          suboptions.
        - The parent_mo_or_dn property for child objects is automatically set as the list
          of children is configured.
      class_name:
        description:
        - Name of the Python class that will be used to configure the Managed Object.
        required: true
      module:
        description:
        - Name of the Python SDK module implementing the required class.
        required: true
      properties:
        description:
        - List of properties to configure on the Managed Object.  See the UCSM Python
          SDK for information on properties for each class.
        required: true

use_ssl:
    default: true
    description:
    - If C(no), an HTTP connection will be used instead of the default HTTPS connection.
    type: bool

hostname:
    description:
    - IP address or hostname of Cisco UCS Manager.
    - Modules can be used with the UCS Platform Emulator U(https://cs.co/ucspe)
    required: true
    type: str

password:
    description:
    - Password for Cisco UCS Manager authentication.
    required: true
    type: str

username:
    default: admin
    description:
    - Username for Cisco UCS Manager authentication.
    type: str

use_proxy:
    default: true
    description:
    - If C(no), will not use the proxy as defined by system environment variable.
    type: bool