Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/remote_management/ucs/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/remote_management/ucs/ucs_managed_objects.pyc

�
�Udac@`sddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
dZyddl
mZeZWn#ek
r�e
j�ZeZnXdd
lmZddlZddlmZmZddlmZmZdd�Zd�Zedkre�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bysi
---
module: ucs_managed_objects
short_description: Configures Managed Objects on Cisco UCS Manager
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).
extends_documentation_fragment: ucs
options:
  state:
    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.
    choices: [ absent, present ]
    default: present
  objects:
    description:
    - List of managed objects to configure.  Each managed object has suboptions the specify the Python SDK module, class, and properties to configure.
    suboptions:
      module:
        description:
        - Name of the Python SDK module implementing the required class.
        required: yes
      class_name:
        description:
        - Name of the Python class that will be used to configure the Managed Object.
        required: yes
      properties:
        description:
        - List of properties to configure on the Managed Object.  See the UCSM Python SDK for information on properties for each class.
        required: yes
      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.
    required: yes
requirements:
- ucsmsdk
author:
- David Soper (@dsoper2)
- CiscoUcs (@CiscoUcs)
version_added: '2.8'
s�
- 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

- 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

- 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"
                                  }
                              }
                          ]
                      }
                  ]
              }
          ]
      }

- 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


s
#
N(t
import_module(tdeepcopy(t
AnsibleModuletmissing_required_lib(t	UCSModuletucs_argument_spectcC`s�t}t|d�}t||d�}|djd�sM||dd<n||d�}|jj|j�}|jddkr�|r�|js�|jj	|�|jj
�nt|jd<q�n�|r(t
|d�}|jdd�|jdd�|jd	d�|j|�r(t}q(n|s�|js�y'|jj|d
t�|jj
�Wq�tk
r�}	t|jd<dt|	�|jd
<q�Xnt|jd<n|jd�r�x4|dD]%}
t|
�}t||||�q�WndS(Ntmoduletclasst
propertiestparent_mo_or_dntstatetabsenttchangedtpwdtpasswordtmodify_presentterrssetup error: %s tmsgtchildren(tFalseRtgetattrtgettlogin_handletquery_dntdntparamst
check_modet	remove_motcommittTruetresulttdicttpoptNonetcheck_prop_matchtadd_mot	ExceptiontstrR	ttraverse_objects(Rtucstmanaged_objecttmotprops_matcht	mo_moduletmo_classtexisting_motkwargstetchildt
copy_of_child((s]/usr/lib/python2.7/site-packages/ansible/modules/remote_management/ucs/ucs_managed_objects.pyR/�sB		
cC`sktdtdddt�dtddddgdt�dtdd	dt�d
tdd��}t}|jdtddd
d	d|dt�dtdddddgdd��t|dt�}ts�|jdtd�dt�nt	|�}t
|jd<t
|jd<x%|jdD]}t
|||�qW|jdrW|j|j�n|j|j�dS(NRttypeR.trequiredt
class_nametaliasesRRR(RtlisttobjectstelementstoptionsRtchoicestpresentRtdefaulttsupports_check_modeRt	importlibt	exceptionRR(R(R&R
tupdateR
tHAS_IMPORT_MODULEt	fail_jsonRtIMPORT_IMP_ERRRRR'R"R/t	exit_json(tobject_dictt
argument_specRR0R1((s]/usr/lib/python2.7/site-packages/ansible/modules/remote_management/ucs/ucs_managed_objects.pytmain�s,	!"	


t__main__( t
__future__RRRR;t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNt	tracebackR*RLRGRR&RJR-t
format_excRtcopyR	tjsontansible.module_utils.basicR
Rt*ansible.module_utils.remote_management.ucsRR
R/RPt__name__(((s]/usr/lib/python2.7/site-packages/ansible/modules/remote_management/ucs/ucs_managed_objects.pyt<module>s.


.e


1	"

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]