�
�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 e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust certifiedt supported_bys�
---
module: ucs_lan_connectivity
short_description: Configures LAN Connectivity Policies on Cisco UCS Manager
description:
- Configures LAN Connectivity Policies on Cisco UCS Manager.
- 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 LAN Connectivity Policies are present and will create if needed.
- If C(absent), will verify LAN Connectivity Policies are absent and will delete if needed.
choices: [present, absent]
default: present
name:
description:
- The name of the LAN Connectivity 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:
- A description of the LAN Connectivity Policy.
- Cisco recommends including information about where and when to use the policy.
- 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 ]
vnic_list:
description:
- List of vNICs used by the LAN Connectivity Policy.
- vNICs used by the LAN Connectivity Policy must be created from a vNIC template.
suboptions:
name:
description:
- The name of the vNIC.
required: yes
vnic_template:
description:
- The name of the vNIC template.
required: yes
adapter_policy:
description:
- The name of the Ethernet adapter policy.
- A user defined policy can be used, or one of the system defined policies.
order:
description:
- String specifying the vNIC assignment order (e.g., '1', '2').
default: 'unspecified'
state:
description:
- If C(present), will verify vnic is configured within policy.
If C(absent), will verify vnic is absent from policy.
choices: [ present, absent ]
default: present
version_added: '2.8'
iscsi_vnic_list:
description:
- List of iSCSI vNICs used by the LAN Connectivity Policy.
suboptions:
name:
description:
- The name of the iSCSI vNIC.
required: yes
overlay_vnic:
description:
- The LAN vNIC associated with this iSCSI vNIC.
iscsi_adapter_policy:
description:
- The iSCSI adapter policy associated with this iSCSI vNIC.
mac_address:
description:
- The MAC address associated with this iSCSI vNIC.
- If the MAC address is not set, Cisco UCS Manager uses a derived MAC address.
default: derived
vlan_name:
description:
- The VLAN used for the iSCSI vNIC.
default: default
state:
description:
- If C(present), will verify iscsi vnic is configured within policy.
If C(absent), will verify iscsi vnic is absent from policy.
choices: [ present, absent ]
default: present
version_added: '2.8'
org_dn:
description:
- Org dn (distinguished name)
default: org-root
requirements:
- ucsmsdk
author:
- David Soper (@dsoper2)
- CiscoUcs (@CiscoUcs)
version_added: '2.5'
sU
- name: Configure LAN Connectivity Policy
ucs_lan_connectivity:
hostname: 172.16.143.150
username: admin
password: password
name: Cntr-FC-Boot
vnic_list:
- name: eno1
vnic_template: Cntr-Template
adapter_policy: Linux
- name: eno2
vnic_template: Container-NFS-A
adapter_policy: Linux
- name: eno3
vnic_template: Container-NFS-B
adapter_policy: Linux
iscsi_vnic_list:
- name: iSCSIa
overlay_vnic: eno1
iscsi_adapter_policy: default
vlan_name: Container-MGMT-VLAN
- name: iSCSIb
overlay_vnic: eno3
iscsi_adapter_policy: default
vlan_name: Container-TNT-A-NFS
- name: Remove LAN Connectivity Policy
ucs_lan_connectivity:
hostname: 172.16.143.150
username: admin
password: password
name: Cntr-FC-Boot
state: absent
s
#
( t
AnsibleModule( t UCSModulet ucs_argument_specc
C` ss d d l m } d d l m } d d l m } d d l m } | j sby�| d | j d d | j d d | j d
� } | j j
d � r6x� | j d D]� } | d d
k r� | d | d } | j j | � }
|
r/| j j
|
� q/q� | d d d | d | d d | d d | d d | d � }
q� Wn | j j
d � rx� | j d D]� } | d d
k r�| d | d } | j j | � }
|
r�| j j
|
� q�qV| d | d | d d | d d | d d | d � }
| d |
d | d � qVWn | j j | t � | j j � Wqbt k
r^} d t | � | j d <| j | j � qbXn t | j d <d S( Ni ( t VnicLanConnPolicy( t VnicEther( t VnicIScsiLCP( t VnicVlant parent_mo_or_dnt org_dnt namet descrt descriptiont vnic_listt statet absents /ether-t addrt derivedt adaptor_profile_namet adapter_policyt
nw_templ_namet
vnic_templatet ordert iscsi_vnic_lists /iscsi-t iscsi_adapter_policyt vnic_namet overlay_vnict mac_addresst vlan_names setup error: %s t msgt changed( t% ucsmsdk.mometa.vnic.VnicLanConnPolicyR t ucsmsdk.mometa.vnic.VnicEtherR t ucsmsdk.mometa.vnic.VnicIScsiLCPR
t ucsmsdk.mometa.vnic.VnicVlanR t
check_modet paramst gett login_handlet query_dnt remove_mot add_mot Truet committ Exceptiont strt resultt fail_json(
t ucst modulet dnR R R
R t mot vnict child_dnt mo_1t
iscsi_vnict e( ( s^ /usr/lib/python2.7/site-packages/ansible/modules/remote_management/ucs/ucs_lan_connectivity.pyt configure_lan_connectivity� s\
c C` s� t } | j j d � r� x� | j d D]� } | d | d } | j j | � } | r� | d d k rp t } Pq� t d | d � } | d | d <| d | d
<| j | � s� t } Pq� q&