�
�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 d � Z d � Z d � Z d � 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_bysI
---
module: ucs_disk_group_policy
short_description: Configures disk group policies on Cisco UCS Manager
description:
- Configures disk group policies on Cisco UCS Manager.
- Examples can be used with the L(UCS Platform Emulator,https://communities.cisco.com/ucspe).
extends_documentation_fragment: ucs
options:
state:
description:
- Desired state of the disk group policy.
- If C(present), will verify that the disk group policy is present and will create if needed.
- If C(absent), will verify that the disk group policy is absent and will delete if needed.
choices: [present, absent]
default: present
name:
description:
- The name of the disk group policy.
This name can be between 1 and 16 alphanumeric characters.
- "You cannot use spaces or any special characters other than - (hyphen), \"_\" (underscore), : (colon), and . (period)."
- You cannot change this name after the policy is created.
required: yes
description:
description:
- The user-defined description of the storage profile.
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 ]
raid_level:
description:
- "The RAID level for the disk group policy. This can be one of the following:"
- "stripe - UCS Manager shows RAID 0 Striped"
- "mirror - RAID 1 Mirrored"
- "mirror-stripe - RAID 10 Mirrored and Striped"
- "stripe-parity - RAID 5 Striped Parity"
- "stripe-dual-parity - RAID 6 Striped Dual Parity"
- "stripe-parity-stripe - RAID 50 Striped Parity and Striped"
- "stripe-dual-parity-stripe - RAID 60 Striped Dual Parity and Striped"
choices: [stripe, mirror, mirror-stripe, stripe-parity, stripe-dual-parity, stripe-parity-stripe, stripe-dual-parity-stripe]
default: stripe
configuration_mode:
description:
- "Disk group configuration mode. Choose one of the following:"
- "automatic - Automatically configures the disks in the disk group."
- "manual - Enables you to manually configure the disks in the disk group."
choices: [automatic, manual]
default: automatic
num_drives:
description:
- Specify the number of drives for the disk group.
- This can be from 0 to 24.
- Option only applies when configuration mode is automatic.
default: 1
drive_type:
description:
- Specify the drive type to use in the drive group.
- "This can be one of the following:"
- "unspecified — Selects the first available drive type, and applies that to all drives in the group."
- "HDD — Hard disk drive"
- "SSD — Solid state drive"
- Option only applies when configuration mode is automatic.
choices: [unspecified, HDD, SSD]
default: unspecified
num_ded_hot_spares:
description:
- Specify the number of hot spares for the disk group.
- This can be from 0 to 24.
- Option only applies when configuration mode is automatic.
default: unspecified
num_glob_hot_spares:
description:
- Specify the number of global hot spares for the disk group.
- This can be from 0 to 24.
- Option only applies when configuration mode is automatic.
default: unspecified
min_drive_size:
description:
- Specify the minimum drive size or unspecified to allow all drive sizes.
- This can be from 0 to 10240 GB.
- Option only applies when configuration mode is automatic.
default: 'unspecified'
use_remaining_disks:
description:
- Specifies whether you can use all the remaining disks in the disk group or not.
- Option only applies when configuration mode is automatic.
choices: ['yes', 'no']
default: 'no'
manual_disks:
description:
- List of manually configured disks.
- Options are only used when you choose manual configuration_mode.
suboptions:
name:
description:
- The name of the local LUN.
required: yes
slot_num:
description:
- The slot number of the specific disk.
role:
description:
- "The role of the disk. This can be one of the following:"
- "normal - Normal"
- "ded-hot-spare - Dedicated Hot Spare"
- "glob-hot-spare - Glob Hot Spare"
span_id:
description:
- The Span ID of the specific disk.
default: 'unspecified'
state:
description:
- If C(present), will verify disk slot is configured within policy.
If C(absent), will verify disk slot is absent from policy.
choices: [ present, absent ]
default: present
virtual_drive:
description:
- Configuration of virtual drive options.
suboptions:
access_policy:
description:
- Configure access policy to virtual drive.
choices: [blocked, hidden, platform-default, read-only, read-write, transport-ready]
default: platform-default
drive_cache:
description:
- Configure drive caching.
choices: [disable, enable, no-change, platform-default]
default: platform-default
io_policy:
description:
- Direct or Cached IO path.
choices: [cached, direct, platform-default]
default: platform-default
read_policy:
description:
- Read access policy to virtual drive.
choices: [normal, platform-default, read-ahead]
default: platform-default
strip_size:
description:
- Virtual drive strip size.
choices: [ present, absent ]
default: platform-default
write_cache_policy:
description:
- Write back cache policy.
choices: [always-write-back, platform-default, write-back-good-bbu, write-through]
default: platform-default
org_dn:
description:
- The distinguished name (dn) of the organization where the resource is assigned.
default: org-root
requirements:
- ucsmsdk
author:
- Sindhu Sudhir (@sisudhir)
- David Soper (@dsoper2)
- CiscoUcs (@CiscoUcs)
- Brett Johnson (@sdbrett)
version_added: '2.8'
s�
- name: Configure Disk Group Policy
ucs_disk_group_policy:
hostname: 172.16.143.150
username: admin
password: password
name: DEE-DG
raid_level: mirror
configuration_mode: manual
manual_disks:
- slot_num: '1'
role: normal
- slot_num: '2'
role: normal
- name: Remove Disk Group Policy
ucs_disk_group_policy:
name: DEE-DG
hostname: 172.16.143.150
username: admin
password: password
state: absent
- name: Remove Disk from Policy
ucs_disk_group_policy:
hostname: 172.16.143.150
username: admin
password: password
name: DEE-DG
description: Testing Ansible
raid_level: stripe
configuration_mode: manual
manual_disks:
- slot_num: '1'
role: normal
- slot_num: '2'
role: normal
state: absent
virtual_drive:
access_policy: platform-default
io_policy: direct
strip_size: 64KB
s
#
( t
AnsibleModule( t UCSModulet ucs_argument_specc C` s d d l m } d d l m } d d l m } | j s�y�| d | j d d | j d d | j d d
| j d
� } | j d d k r� | d | d
| j d
d | j d d | j d d | j d d | j d d | j d � n� x� | j d D]� } | d d k rN| d | d } | j j | � } | ry| j j
| � qyq� | d | d | d d | d d | d � q� W| j d r�t | | � n | j j | t
� | j j � Wq�t k
r�}
d t |
� | j d <| j | j � q�Xn t
| j d <d S( Ni ( t LstorageDiskGroupConfigPolicy( t LstorageDiskGroupQualifier( t LstorageLocalDiskConfigReft parent_mo_or_dnt org_dnt namet descrt descriptiont
raid_levelt configuration_modet automatict
num_drivest
drive_typet use_remaining_diskst num_ded_hot_sparest num_glob_hot_sparest min_drive_sizet manual_diskst statet absents /slot-t slot_numt rolet span_idt
virtual_drives setup error: %s t msgt changed( t5 ucsmsdk.mometa.lstorage.LstorageDiskGroupConfigPolicyR t2 ucsmsdk.mometa.lstorage.LstorageDiskGroupQualifierR t2 ucsmsdk.mometa.lstorage.LstorageLocalDiskConfigRefR
t
check_modet paramst login_handlet query_dnt remove_mot _configure_virtual_drivet add_mot Truet committ Exceptiont strt resultt fail_json( t ucst modulet dnR R R
t mot diskt child_dnt mo_1t e( ( s_ /usr/lib/python2.7/site-packages/ansible/modules/remote_management/ucs/ucs_disk_group_policy.pyt configure_disk_policy� sL
c C` s� t } t d | j d � } | j d | d <| j | � r�| j d d k r� | d } | j j | � } | r�t d | j d � } | j d | d <| j d | d <| j d
| d
<| j d | d <| j d | d <| j | � } q�n� x� | j d
D]� } | d | d } | j j | � } | r� | d d k rHt } q�t d | d � } | d | d <| d | d <| j | � s�t } Pq�q� q� W| r�| j d r�t | | | � } q�q�n t } | S( NR R R R R s /disk-group-qualR R R R R R R s /slot-R R R R R! R"