�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
m Z d d l m
Z
m Z d
� Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys�
---
module: ucs_org
short_description: Manages UCS Organizations for UCS Manager
description:
- Manages UCS Organizations for UCS Manager.
- Examples can be used with the UCS Platform Emulator U(https://cs.co/ucspe).
extends_documentation_fragment: ucs
options:
state:
description:
- If C(absent), will remove organization.
- If C(present), will create or update organization.
choices: [absent, present]
default: present
type: str
org_name:
description:
- The name of the organization.
- Enter up to 16 characters.
- "You can use any characters or spaces except the following:"
- "` (accent mark), \ (backslash), ^ (carat), \" (double quote), = (equal sign), > (greater than), < (less than), or ' (single quote)."
aliases: [ name ]
type: str
parent_org_path:
description:
- A forward slash / separated hierarchical path from the root organization to the parent of the organization to be added or updated.
- UCS Manager supports a hierarchical structure of organizations up to five levels deep not including the root organization.
- For example the parent_org_path for an organization named level5 could be root/level1/level2/level3/level4/level5
default: root
type: str
description:
description:
- A user-defined description of the organization.
- Enter up to 256 characters.
- "You can use any characters or spaces except the following:"
- "` (accent mark), \ (backslash), ^ (carat), \" (double quote), = (equal sign), > (greater than), < (less than), or ' (single quote)."
aliases: [ descr ]
type: str
delegate_to:
description:
- Where the module will be run
default: localhost
type: str
requirements:
- ucsmsdk
author:
- John McDonough (@movinalot)
- CiscoUcs (@CiscoUcs)
version_added: "2.8"
s�
- name: Add UCS Organization
ucs_org:
hostname: "{{ ucs_hostname }}"
username: "{{ ucs_username }}"
password: "{{ ucs_password }}"
org_name: test
description: testing org
state: present
delegate_to: localhost
- name: Update UCS Organization
ucs_org:
hostname: "{{ ucs_hostname }}"
username: "{{ ucs_username }}"
password: "{{ ucs_password }}"
org_name: test
description: Testing org
state: present
delegate_to: localhost
- name: Add UCS Organization
ucs_org:
hostname: "{{ ucs_hostname }}"
username: "{{ ucs_username }}"
password: "{{ ucs_password }}"
org_name: level1
parent_org_path: root
description: level1 org
state: present
delegate_to: localhost
- name: Add UCS Organization
ucs_org:
hostname: "{{ ucs_hostname }}"
username: "{{ ucs_username }}"
password: "{{ ucs_password }}"
org_name: level2
parent_org_path: root/level1
description: level2 org
state: present
- name: Add UCS Organization
ucs_org:
hostname: "{{ ucs_hostname }}"
username: "{{ ucs_username }}"
password: "{{ ucs_password }}"
org_name: level3
parent_org_path: root/level1/level2
description: level3 org
state: present
- name: Remove UCS Organization
ucs_org:
hostname: "{{ ucs_hostname }}"
username: "{{ ucs_username }}"
password: "{{ ucs_password }}"
org_name: level2
parent_org_path: root/level1/
state: absent
s
#
( t
AnsibleModule( t UCSModulet ucs_argument_specc C` s� t } | j d t d d d d g � d t d d d d � d t d d d d
g � d t d d d d d
d d g � d t d d d d � � t | d t d d d d g g g �} t | � } d d l m } t } t } | j d } t � } | j d d k r| j d | d
<n yKd | j d j d d � } | d | j d } | j j
| � }
|
r�| d k r�|
j | � s�t } q�q�n | d k r�t } n |
r�| d k r�t } n | ra| j ra| d k r�| j j |
� nd | | d <| j d | d <| j d d k r/| j d | d
<n | | � }
| j j |
d t �| j j � n Wn0 t k
r�} t } d t | � | j d <n X| | j d <| r�| j | j � n | j | j � d S( Nt org_namet typet strt aliasest namet parent_org_patht defaultt roott descriptiont descrt statet presentt choicest absentt delegate_tot localhostt supports_check_modet required_ifi ( t OrgOrgs org-t /s /org-t parent_mo_or_dnt modify_presents setup error: %s t msgt changed( R
t updatet dictR t TrueR t ucsmsdk.mometa.org.OrgOrgR t Falset paramst Nonet replacet login_handlet query_dnt check_prop_matcht
check_modet remove_mot add_mot committ ExceptionR
t resultt fail_jsont exit_json( t
argument_spect modulet ucsR t errR"