diff --git a/lib/ansible/module_utils/remote_management/ucs.py b/lib/ansible/module_utils/remote_management/ucs.py deleted file mode 100644 index bbb0a407a5a..00000000000 --- a/lib/ansible/module_utils/remote_management/ucs.py +++ /dev/null @@ -1,97 +0,0 @@ -# This code is part of Ansible, but is an independent component. -# This particular file snippet, and this file snippet only, is BSD licensed. -# Modules you write using this snippet, which is embedded dynamically by Ansible -# still belong to the author of the module, and may assign their own license -# to the complete work. -# -# (c) 2016 Red Hat Inc. -# (c) 2019 Cisco Systems Inc. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -import traceback - -from ansible.module_utils.basic import missing_required_lib - -UCSMSDK_IMP_ERR = None -try: - import ucsmsdk - HAS_UCSMSDK = True -except Exception: - UCSMSDK_IMP_ERR = traceback.format_exc() - HAS_UCSMSDK = False - -ucs_argument_spec = dict( - hostname=dict(type='str', required=True), - username=dict(type='str', default='admin'), - password=dict(type='str', required=True, no_log=True), - port=dict(type='int', default=None), - use_ssl=dict(type='bool', default=True), - use_proxy=dict(type='bool', default=True), - proxy=dict(type='str', default=None), -) - - -class UCSModule(): - - def __init__(self, module): - self.module = module - self.result = {} - if not HAS_UCSMSDK: - self.module.fail_json(msg=missing_required_lib('ucsmsdk'), exception=UCSMSDK_IMP_ERR) - self.login() - - def __del__(self): - self.logout() - - def login(self): - from ucsmsdk.ucshandle import UcsHandle - - # use_proxy=yes (default) and proxy=None (default) should be using the system defined proxy - # use_proxy=yes (default) and proxy=value should use the provided proxy - # use_proxy=no (user) should not be using a proxy - if self.module.params['use_proxy']: - proxy = self.module.params['proxy'] - else: - # force no proxy to be used. Note that proxy=None in UcsHandle will - # use the system proxy so we must set to something else - proxy = {} - - try: - handle = UcsHandle( - ip=self.module.params['hostname'], - username=self.module.params['username'], - password=self.module.params['password'], - port=self.module.params['port'], - secure=self.module.params['use_ssl'], - proxy=proxy - ) - handle.login() - except Exception as e: - self.result['msg'] = str(e) - self.module.fail_json(**self.result) - self.login_handle = handle - - def logout(self): - if hasattr(self, 'login_handle'): - self.login_handle.logout() - return True - return False diff --git a/lib/ansible/modules/remote_management/ucs/ucs_disk_group_policy.py b/lib/ansible/modules/remote_management/ucs/ucs_disk_group_policy.py deleted file mode 100644 index cf296a924a1..00000000000 --- a/lib/ansible/modules/remote_management/ucs/ucs_disk_group_policy.py +++ /dev/null @@ -1,422 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function - -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} - -DOCUMENTATION = r''' ---- -module: ucs_disk_group_policy -short_description: Configures disk group policies on Cisco UCS Manager -description: -- Configures disk group policies on Cisco UCS Manager. -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' -''' - -EXAMPLES = r''' -- 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 -''' - -RETURN = r''' -# -''' - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.remote_management.ucs import UCSModule, ucs_argument_spec - - -def configure_disk_policy(ucs, module, dn): - from ucsmsdk.mometa.lstorage.LstorageDiskGroupConfigPolicy import LstorageDiskGroupConfigPolicy - from ucsmsdk.mometa.lstorage.LstorageDiskGroupQualifier import LstorageDiskGroupQualifier - from ucsmsdk.mometa.lstorage.LstorageLocalDiskConfigRef import LstorageLocalDiskConfigRef - - if not module.check_mode: - try: - # create if mo does not already exist - mo = LstorageDiskGroupConfigPolicy( - parent_mo_or_dn=module.params['org_dn'], - name=module.params['name'], - descr=module.params['description'], - raid_level=module.params['raid_level'], - ) - if module.params['configuration_mode'] == 'automatic': - LstorageDiskGroupQualifier( - parent_mo_or_dn=mo, - num_drives=module.params['num_drives'], - drive_type=module.params['drive_type'], - use_remaining_disks=module.params['use_remaining_disks'], - num_ded_hot_spares=module.params['num_ded_hot_spares'], - num_glob_hot_spares=module.params['num_glob_hot_spares'], - min_drive_size=module.params['min_drive_size'], - ) - else: # configuration_mode == 'manual' - for disk in module.params['manual_disks']: - if disk['state'] == 'absent': - child_dn = dn + '/slot-' + disk['slot_num'] - mo_1 = ucs.login_handle.query_dn(child_dn) - if mo_1: - ucs.login_handle.remove_mo(mo_1) - else: # state == 'present' - LstorageLocalDiskConfigRef( - parent_mo_or_dn=mo, - slot_num=disk['slot_num'], - role=disk['role'], - span_id=disk['span_id'], - ) - - if module.params['virtual_drive']: - _configure_virtual_drive(module, mo) - - ucs.login_handle.add_mo(mo, True) - ucs.login_handle.commit() - except Exception as e: # generic Exception handling because SDK can throw a variety - ucs.result['msg'] = "setup error: %s " % str(e) - module.fail_json(**ucs.result) - - ucs.result['changed'] = True - - -def check_disk_policy_props(ucs, module, mo, dn): - props_match = True - - # check top-level mo props - kwargs = dict(descr=module.params['description']) - kwargs['raid_level'] = module.params['raid_level'] - if mo.check_prop_match(**kwargs): - # top-level props match, check next level mo/props - if module.params['configuration_mode'] == 'automatic': - child_dn = dn + '/disk-group-qual' - mo_1 = ucs.login_handle.query_dn(child_dn) - if mo_1: - kwargs = dict(num_drives=module.params['num_drives']) - kwargs['drive_type'] = module.params['drive_type'] - kwargs['use_remaining_disks'] = module.params['use_remaining_disks'] - kwargs['num_ded_hot_spares'] = module.params['num_ded_hot_spares'] - kwargs['num_glob_hot_spares'] = module.params['num_glob_hot_spares'] - kwargs['min_drive_size'] = module.params['min_drive_size'] - props_match = mo_1.check_prop_match(**kwargs) - - else: # configuration_mode == 'manual' - for disk in module.params['manual_disks']: - child_dn = dn + '/slot-' + disk['slot_num'] - mo_1 = ucs.login_handle.query_dn(child_dn) - if mo_1: - if disk['state'] == 'absent': - props_match = False - else: # state == 'present' - kwargs = dict(slot_num=disk['slot_num']) - kwargs['role'] = disk['role'] - kwargs['span_id'] = disk['span_id'] - if not mo_1.check_prop_match(**kwargs): - props_match = False - break - if props_match: - if module.params['virtual_drive']: - props_match = check_virtual_drive_props(ucs, module, dn) - else: - props_match = False - return props_match - - -def check_virtual_drive_props(ucs, module, dn): - child_dn = dn + '/virtual-drive-def' - mo_1 = ucs.login_handle.query_dn(child_dn) - return mo_1.check_prop_match(**module.params['virtual_drive']) - - -def _configure_virtual_drive(module, mo): - from ucsmsdk.mometa.lstorage.LstorageVirtualDriveDef import LstorageVirtualDriveDef - LstorageVirtualDriveDef(parent_mo_or_dn=mo, **module.params['virtual_drive']) - - -def _virtual_drive_argument_spec(): - return dict( - access_policy=dict(type='str', default='platform-default', - choices=["blocked", "hidden", "platform-default", "read-only", "read-write", - "transport-ready"]), - drive_cache=dict(type='str', default='platform-default', - choices=["disable", "enable", "no-change", "platform-default"]), - io_policy=dict(type='str', default='platform-default', - choices=["cached", "direct", "platform-default"]), - read_policy=dict(type='str', default='platform-default', - choices=["normal", "platform-default", "read-ahead"]), - strip_size=dict(type='str', default='platform-default', - choices=["1024KB", "128KB", "16KB", "256KB", "32KB", "512KB", "64KB", "8KB", - "platform-default"]), - write_cache_policy=dict(type='str', default='platform-default', - choices=["always-write-back", "platform-default", "write-back-good-bbu", - "write-through"]), - ) - - -def main(): - manual_disk = dict( - slot_num=dict(type='str', required=True), - role=dict(type='str', default='normal', choices=['normal', 'ded-hot-spare', 'glob-hot-spare']), - span_id=dict(type='str', default='unspecified'), - state=dict(type='str', default='present', choices=['present', 'absent']), - ) - - argument_spec = ucs_argument_spec - argument_spec.update( - org_dn=dict(type='str', default='org-root'), - name=dict(type='str', required=True), - description=dict(type='str', aliases=['descr'], default=''), - raid_level=dict( - type='str', - default='stripe', - choices=[ - 'stripe', - 'mirror', - 'mirror-stripe', - 'stripe-parity', - 'stripe-dual-parity', - 'stripe-parity-stripe', - 'stripe-dual-parity-stripe', - ], - ), - num_drives=dict(type='str', default='1'), - configuration_mode=dict(type='str', default='automatic', choices=['automatic', 'manual']), - num_ded_hot_spares=dict(type='str', default='unspecified'), - num_glob_hot_spares=dict(type='str', default='unspecified'), - drive_type=dict(type='str', default='unspecified', choices=['unspecified', 'HDD', 'SSD']), - use_remaining_disks=dict(type='str', default='no', choices=['yes', 'no']), - min_drive_size=dict(type='str', default='unspecified'), - manual_disks=dict(type='list', elements='dict', options=manual_disk), - state=dict(type='str', default='present', choices=['present', 'absent']), - virtual_drive=dict(type='dict', options=_virtual_drive_argument_spec()), - ) - module = AnsibleModule( - argument_spec, - supports_check_mode=True, - ) - ucs = UCSModule(module) - # UCSModule creation above verifies ucsmsdk is present and exits on failure. - # Additional imports are done below or in called functions. - - ucs.result['changed'] = False - props_match = False - # dn is /disk-group-config- - dn = module.params['org_dn'] + '/disk-group-config-' + module.params['name'] - - mo = ucs.login_handle.query_dn(dn) - if mo: - if module.params['state'] == 'absent': - # mo must exist but all properties do not have to match - if not module.check_mode: - ucs.login_handle.remove_mo(mo) - ucs.login_handle.commit() - ucs.result['changed'] = True - else: # state == 'present' - props_match = check_disk_policy_props(ucs, module, mo, dn) - - if module.params['state'] == 'present' and not props_match: - configure_disk_policy(ucs, module, dn) - - module.exit_json(**ucs.result) - - -if __name__ == '__main__': - main() diff --git a/lib/ansible/modules/remote_management/ucs/ucs_dns_server.py b/lib/ansible/modules/remote_management/ucs/ucs_dns_server.py deleted file mode 100644 index 235fe81e587..00000000000 --- a/lib/ansible/modules/remote_management/ucs/ucs_dns_server.py +++ /dev/null @@ -1,168 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} - -DOCUMENTATION = r''' ---- -module: ucs_dns_server - -short_description: Configure DNS servers on Cisco UCS Manager - -extends_documentation_fragment: -- ucs - -description: -- Configure DNS servers on Cisco UCS Manager. - -options: - state: - description: - - If C(absent), will remove a DNS server. - - If C(present), will add or update a DNS server. - choices: [absent, present] - default: present - type: str - - dns_server: - description: - - DNS server IP address. - - Enter a valid IPV4 Address. - - UCS Manager supports up to 4 DNS Servers - aliases: [ name ] - type: str - - description: - description: - - A user-defined description of the DNS server. - - 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" -''' - -EXAMPLES = r''' -- name: Configure DNS server - ucs_dns_server: - hostname: 172.16.143.150 - username: admin - password: password - dns_server: 10.10.10.10 - description: DNS Server IP address - state: present - delegate_to: localhost - -- name: Remove DNS server - ucs_dns_server: - hostname: 172.16.143.150 - username: admin - password: password - dns_server: 10.10.10.10 - state: absent - delegate_to: localhost -''' - -RETURN = r''' -# -''' - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.remote_management.ucs import UCSModule, ucs_argument_spec - - -def run_module(): - argument_spec = ucs_argument_spec - argument_spec.update( - dns_server=dict(type='str', aliases=['name']), - description=dict(type='str', aliases=['descr'], default=''), - state=dict(type='str', default='present', choices=['present', 'absent']), - delegate_to=dict(type='str', default='localhost'), - ) - - module = AnsibleModule( - argument_spec, - supports_check_mode=True, - required_if=[ - ['state', 'present', ['dns_server']], - ], - ) - # UCSModule verifies ucsmsdk is present and exits on failure. - # Imports are below for UCS object creation. - ucs = UCSModule(module) - from ucsmsdk.mometa.comm.CommDnsProvider import CommDnsProvider - - err = False - changed = False - - try: - mo_exists = False - props_match = False - - dn = 'sys/svc-ext/dns-svc/dns-' + module.params['dns_server'] - - mo = ucs.login_handle.query_dn(dn) - if mo: - mo_exists = True - - if module.params['state'] == 'absent': - if mo_exists: - if not module.check_mode: - ucs.login_handle.remove_mo(mo) - ucs.login_handle.commit() - changed = True - else: - if mo_exists: - # check top-level mo props - kwargs = dict(descr=module.params['description']) - if mo.check_prop_match(**kwargs): - props_match = True - - if not props_match: - if not module.check_mode: - # update/add mo - mo = CommDnsProvider(parent_mo_or_dn='sys/svc-ext/dns-svc', - name=module.params['dns_server'], - descr=module.params['description']) - ucs.login_handle.add_mo(mo, modify_present=True) - ucs.login_handle.commit() - changed = True - - except Exception as e: - err = True - ucs.result['msg'] = "setup error: %s " % str(e) - - ucs.result['changed'] = changed - if err: - module.fail_json(**ucs.result) - module.exit_json(**ucs.result) - - -def main(): - run_module() - - -if __name__ == '__main__': - main() diff --git a/lib/ansible/modules/remote_management/ucs/ucs_ip_pool.py b/lib/ansible/modules/remote_management/ucs/ucs_ip_pool.py deleted file mode 100644 index 02e576eb37b..00000000000 --- a/lib/ansible/modules/remote_management/ucs/ucs_ip_pool.py +++ /dev/null @@ -1,296 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'certified'} - -DOCUMENTATION = r''' ---- -module: ucs_ip_pool -short_description: Configures IP address pools on Cisco UCS Manager -description: -- Configures IP address pools and blocks of IP addresses on Cisco UCS Manager. -extends_documentation_fragment: ucs -options: - state: - description: - - If C(present), will verify IP pool is present and will create if needed. - - If C(absent), will verify IP pool is absent and will delete if needed. - choices: [present, absent] - default: present - name: - description: - - The name of the IP address pool. - - This name can be between 1 and 32 alphanumeric characters. - - "You cannot use spaces or any special characters other than - (hyphen), \"_\" (underscore), : (colon), and . (period)." - - You cannot change this name after the IP address pool is created. - required: yes - description: - description: - - The user-defined description of the IP address pool. - - 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, descrption ] - order: - description: - - The Assignment Order field. - - "This can be one of the following:" - - "default - Cisco UCS Manager selects a random identity from the pool." - - "sequential - Cisco UCS Manager selects the lowest available identity from the pool." - choices: [default, sequential] - default: default - first_addr: - description: - - The first IPv4 address in the IPv4 addresses block. - - This is the From field in the UCS Manager Add IPv4 Blocks menu. - last_addr: - description: - - The last IPv4 address in the IPv4 addresses block. - - This is the To field in the UCS Manager Add IPv4 Blocks menu. - subnet_mask: - description: - - The subnet mask associated with the IPv4 addresses in the block. - default: 255.255.255.0 - default_gw: - description: - - The default gateway associated with the IPv4 addresses in the block. - default: 0.0.0.0 - primary_dns: - description: - - The primary DNS server that this block of IPv4 addresses should access. - default: 0.0.0.0 - secondary_dns: - description: - - The secondary DNS server that this block of IPv4 addresses should access. - default: 0.0.0.0 - ipv6_first_addr: - description: - - The first IPv6 address in the IPv6 addresses block. - - This is the From field in the UCS Manager Add IPv6 Blocks menu. - ipv6_last_addr: - description: - - The last IPv6 address in the IPv6 addresses block. - - This is the To field in the UCS Manager Add IPv6 Blocks menu. - ipv6_prefix: - description: - - The network address prefix associated with the IPv6 addresses in the block. - default: '64' - ipv6_default_gw: - description: - - The default gateway associated with the IPv6 addresses in the block. - default: '::' - ipv6_primary_dns: - description: - - The primary DNS server that this block of IPv6 addresses should access. - default: '::' - ipv6_secondary_dns: - description: - - The secondary DNS server that this block of IPv6 addresses should access. - default: '::' - org_dn: - description: - - Org dn (distinguished name) - default: org-root -requirements: -- ucsmsdk -author: -- David Soper (@dsoper2) -- CiscoUcs (@CiscoUcs) -version_added: '2.5' -''' - -EXAMPLES = r''' -- name: Configure IPv4 address pools - ucs_ip_pool: - hostname: 172.16.143.150 - username: admin - password: password - name: ip-A - order: sequential - first_addr: 192.168.0.10 - last_addr: 192.168.0.19 - subnet_mask: 255.255.255.0 - default_gw: 192.168.0.1 - primary_dns: 172.16.143.136 -- name: Configure IPv6 address pools - ucs_ip_pool: - hostname: 172.16.143.150 - username: admin - password: password - name: ipv6-B - ipv6_first_addr: fe80::1cae:7992:d7a1:ed07 - ipv6_last_addr: fe80::1cae:7992:d7a1:edfe - ipv6_default_gw: fe80::1cae:7992:d7a1:ecff - -- name: Remove IPv4 address pools - ucs_ip_pool: - hostname: 172.16.143.150 - username: admin - password: password - name: ip-A - state: absent -- name: Remove IPv6 address pools - ucs_ip_pool: - hostname: 172.16.143.150 - username: admin - password: password - name: ipv6-B - state: absent -''' - -RETURN = r''' -# -''' - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.remote_management.ucs import UCSModule, ucs_argument_spec - - -def main(): - argument_spec = ucs_argument_spec - argument_spec.update( - org_dn=dict(type='str', default='org-root'), - name=dict(type='str', required=True), - descr=dict(type='str', default='', aliases=['descrption', 'description']), - order=dict(type='str', default='default', choices=['default', 'sequential']), - first_addr=dict(type='str'), - last_addr=dict(type='str'), - subnet_mask=dict(type='str', default='255.255.255.0'), - default_gw=dict(type='str', default='0.0.0.0'), - primary_dns=dict(type='str', default='0.0.0.0'), - secondary_dns=dict(type='str', default='0.0.0.0'), - ipv6_first_addr=dict(type='str'), - ipv6_last_addr=dict(type='str'), - ipv6_prefix=dict(type='str', default='64'), - ipv6_default_gw=dict(type='str', default='::'), - ipv6_primary_dns=dict(type='str', default='::'), - ipv6_secondary_dns=dict(type='str', default='::'), - state=dict(type='str', default='present', choices=['present', 'absent']), - ) - - module = AnsibleModule( - argument_spec, - supports_check_mode=True, - ) - # UCSModule verifies ucsmsdk is present and exits on failure. Imports are below ucs object creation. - ucs = UCSModule(module) - - err = False - - from ucsmsdk.mometa.ippool.IppoolPool import IppoolPool - from ucsmsdk.mometa.ippool.IppoolBlock import IppoolBlock - from ucsmsdk.mometa.ippool.IppoolIpV6Block import IppoolIpV6Block - - changed = False - try: - mo_exists = False - props_match = False - # dn is /ip-pool- - dn = module.params['org_dn'] + '/ip-pool-' + module.params['name'] - - mo = ucs.login_handle.query_dn(dn) - if mo: - mo_exists = True - - if module.params['state'] == 'absent': - if mo_exists: - if not module.check_mode: - ucs.login_handle.remove_mo(mo) - ucs.login_handle.commit() - changed = True - else: - if mo_exists: - # check top-level mo props - kwargs = dict(assignment_order=module.params['order']) - kwargs['descr'] = module.params['descr'] - if (mo.check_prop_match(**kwargs)): - # top-level props match, check next level mo/props - if module.params['last_addr'] and module.params['first_addr']: - # ipv4 block specified, check properties - block_dn = dn + '/block-' + module.params['first_addr'] + '-' + module.params['last_addr'] - mo_1 = ucs.login_handle.query_dn(block_dn) - if mo_1: - kwargs = dict(subnet=module.params['subnet_mask']) - kwargs['def_gw'] = module.params['default_gw'] - kwargs['prim_dns'] = module.params['primary_dns'] - kwargs['sec_dns'] = module.params['secondary_dns'] - if (mo_1.check_prop_match(**kwargs)): - # ipv4 block exists and properties match - props_match = True - else: - # no ipv4 block specified, but top-level props matched - props_match = True - - # only check ipv6 props if the top-level and ipv4 props matched - if props_match and module.params['ipv6_last_addr'] and module.params['ipv6_first_addr']: - # ipv6 block specified, check properties - block_dn = dn + '/v6block-' + module.params['ipv6_first_addr'].lower() + '-' + module.params['ipv6_last_addr'].lower() - mo_1 = ucs.login_handle.query_dn(block_dn) - if mo_1: - kwargs = dict(prefix=module.params['ipv6_prefix']) - kwargs['def_gw'] = module.params['ipv6_default_gw'] - kwargs['prim_dns'] = module.params['ipv6_primary_dns'] - kwargs['sec_dns'] = module.params['ipv6_secondary_dns'] - if (mo_1.check_prop_match(**kwargs)): - # ipv6 block exists and properties match - props_match = True - else: - # no ipv6 block specified, but previous checks matched - props_match = True - - if not props_match: - if not module.check_mode: - # create if mo does not already exist - mo = IppoolPool( - parent_mo_or_dn=module.params['org_dn'], - name=module.params['name'], - descr=module.params['descr'], - assignment_order=module.params['order'], - ) - - if module.params['last_addr'] and module.params['first_addr']: - mo_1 = IppoolBlock( - parent_mo_or_dn=mo, - to=module.params['last_addr'], - r_from=module.params['first_addr'], - subnet=module.params['subnet_mask'], - def_gw=module.params['default_gw'], - prim_dns=module.params['primary_dns'], - sec_dns=module.params['secondary_dns'], - ) - - if module.params['ipv6_last_addr'] and module.params['ipv6_first_addr']: - mo_1 = IppoolIpV6Block( - parent_mo_or_dn=mo, - to=module.params['ipv6_last_addr'], - r_from=module.params['ipv6_first_addr'], - prefix=module.params['ipv6_prefix'], - def_gw=module.params['ipv6_default_gw'], - prim_dns=module.params['ipv6_primary_dns'], - sec_dns=module.params['ipv6_secondary_dns'], - ) - - ucs.login_handle.add_mo(mo, True) - ucs.login_handle.commit() - - changed = True - - except Exception as e: - err = True - ucs.result['msg'] = "setup error: %s " % str(e) - - ucs.result['changed'] = changed - if err: - module.fail_json(**ucs.result) - module.exit_json(**ucs.result) - - -if __name__ == '__main__': - main() diff --git a/lib/ansible/modules/remote_management/ucs/ucs_lan_connectivity.py b/lib/ansible/modules/remote_management/ucs/ucs_lan_connectivity.py deleted file mode 100644 index c226963fc74..00000000000 --- a/lib/ansible/modules/remote_management/ucs/ucs_lan_connectivity.py +++ /dev/null @@ -1,354 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'certified'} - -DOCUMENTATION = r''' ---- -module: ucs_lan_connectivity -short_description: Configures LAN Connectivity Policies on Cisco UCS Manager -description: -- Configures LAN Connectivity Policies on Cisco UCS Manager. -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' -''' - -EXAMPLES = r''' -- 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 -''' - -RETURN = r''' -# -''' - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.remote_management.ucs import UCSModule, ucs_argument_spec - - -def configure_lan_connectivity(ucs, module, dn): - from ucsmsdk.mometa.vnic.VnicLanConnPolicy import VnicLanConnPolicy - from ucsmsdk.mometa.vnic.VnicEther import VnicEther - from ucsmsdk.mometa.vnic.VnicIScsiLCP import VnicIScsiLCP - from ucsmsdk.mometa.vnic.VnicVlan import VnicVlan - - if not module.check_mode: - try: - # create if mo does not already exist - mo = VnicLanConnPolicy( - parent_mo_or_dn=module.params['org_dn'], - name=module.params['name'], - descr=module.params['description'], - ) - - if module.params.get('vnic_list'): - for vnic in module.params['vnic_list']: - if vnic['state'] == 'absent': - child_dn = dn + '/ether-' + vnic['name'] - mo_1 = ucs.login_handle.query_dn(child_dn) - if mo_1: - ucs.login_handle.remove_mo(mo_1) - else: # state == 'present' - mo_1 = VnicEther( - addr='derived', - parent_mo_or_dn=mo, - name=vnic['name'], - adaptor_profile_name=vnic['adapter_policy'], - nw_templ_name=vnic['vnic_template'], - order=vnic['order'], - ) - - if module.params.get('iscsi_vnic_list'): - for iscsi_vnic in module.params['iscsi_vnic_list']: - if iscsi_vnic['state'] == 'absent': - child_dn = dn + '/iscsi-' + iscsi_vnic['name'] - mo_1 = ucs.login_handle.query_dn(child_dn) - if mo_1: - ucs.login_handle.remove_mo(mo_1) - else: # state == 'present' - mo_1 = VnicIScsiLCP( - parent_mo_or_dn=mo, - name=iscsi_vnic['name'], - adaptor_profile_name=iscsi_vnic['iscsi_adapter_policy'], - vnic_name=iscsi_vnic['overlay_vnic'], - addr=iscsi_vnic['mac_address'], - ) - VnicVlan( - parent_mo_or_dn=mo_1, - vlan_name=iscsi_vnic['vlan_name'], - ) - - ucs.login_handle.add_mo(mo, True) - ucs.login_handle.commit() - except Exception as e: # generic Exception handling because SDK can throw a variety of exceptions - ucs.result['msg'] = "setup error: %s " % str(e) - module.fail_json(**ucs.result) - - ucs.result['changed'] = True - - -def check_vnic_props(ucs, module, dn): - props_match = True - - if module.params.get('vnic_list'): - # check vnicEther props - for vnic in module.params['vnic_list']: - child_dn = dn + '/ether-' + vnic['name'] - mo_1 = ucs.login_handle.query_dn(child_dn) - if mo_1: - if vnic['state'] == 'absent': - props_match = False - break - else: # state == 'present' - kwargs = dict(adaptor_profile_name=vnic['adapter_policy']) - kwargs['order'] = vnic['order'] - kwargs['nw_templ_name'] = vnic['vnic_template'] - if not (mo_1.check_prop_match(**kwargs)): - props_match = False - break - else: # mo_1 did not exist - if vnic['state'] == 'present': - props_match = False - break - - return props_match - - -def check_iscsi_vnic_props(ucs, module, dn): - props_match = True - - if module.params.get('iscsi_vnic_list'): - # check vnicIScsiLCP props - for iscsi_vnic in module.params['iscsi_vnic_list']: - child_dn = dn + '/iscsi-' + iscsi_vnic['name'] - mo_1 = ucs.login_handle.query_dn(child_dn) - if mo_1: - if iscsi_vnic['state'] == 'absent': - props_match = False - break - else: # state == 'present' - kwargs = dict(vnic_name=iscsi_vnic['overlay_vnic']) - kwargs['adaptor_profile_name'] = iscsi_vnic['iscsi_adapter_policy'] - kwargs['addr'] = iscsi_vnic['mac_address'] - if (mo_1.check_prop_match(**kwargs)): - # check vlan - child_dn = child_dn + '/vlan' - mo_2 = ucs.login_handle.query_dn(child_dn) - if mo_2: - kwargs = dict(vlan_name=iscsi_vnic['vlan_name']) - if not (mo_2.check_prop_match(**kwargs)): - props_match = False - break - else: # mo_1 props did not match - props_match = False - break - else: # mo_1 did not exist - if iscsi_vnic['state'] == 'present': - props_match = False - break - - return props_match - - -def check_lan_connecivity_props(ucs, module, mo, dn): - props_match = False - - # check top-level mo props - kwargs = dict(descr=module.params['description']) - if (mo.check_prop_match(**kwargs)): - # top-level props match, check next level mo/props - # check vnic 1st - props_match = check_vnic_props(ucs, module, dn) - - if props_match: - props_match = check_iscsi_vnic_props(ucs, module, dn) - - return props_match - - -def main(): - vnic = dict( - name=dict(type='str', required=True), - vnic_template=dict(type='str', required=True), - adapter_policy=dict(type='str', default=''), - order=dict(type='str', default='unspecified'), - state=dict(type='str', default='present', choices=['present', 'absent']), - ) - iscsi_vnic = dict( - name=dict(type='str', required=True), - overlay_vnic=dict(type='str', default=''), - iscsi_adapter_policy=dict(type='str', default=''), - mac_address=dict(type='str', default='derived'), - vlan_name=dict(type='str', default='default'), - state=dict(type='str', default='present', choices=['present', 'absent']), - ) - - argument_spec = ucs_argument_spec - argument_spec.update( - org_dn=dict(type='str', default='org-root'), - name=dict(type='str', required=True), - description=dict(type='str', aliases=['descr'], default=''), - vnic_list=dict(type='list', elements='dict', options=vnic), - iscsi_vnic_list=dict(type='list', elements='dict', options=iscsi_vnic), - state=dict(type='str', default='present', choices=['present', 'absent']), - ) - - module = AnsibleModule( - argument_spec, - supports_check_mode=True, - ) - ucs = UCSModule(module) - # UCSModule creation above verifies ucsmsdk is present and exits on failure. - # Additional imports are done below or in called functions. - - ucs.result['changed'] = False - props_match = False - # dn is /lan-conn-pol- - dn = module.params['org_dn'] + '/lan-conn-pol-' + module.params['name'] - - mo = ucs.login_handle.query_dn(dn) - if mo: - if module.params['state'] == 'absent': - # mo must exist but all properties do not have to match - if not module.check_mode: - ucs.login_handle.remove_mo(mo) - ucs.login_handle.commit() - ucs.result['changed'] = True - else: # state == 'present' - props_match = check_lan_connecivity_props(ucs, module, mo, dn) - - if module.params['state'] == 'present' and not props_match: - configure_lan_connectivity(ucs, module, dn) - - module.exit_json(**ucs.result) - - -if __name__ == '__main__': - main() diff --git a/lib/ansible/modules/remote_management/ucs/ucs_mac_pool.py b/lib/ansible/modules/remote_management/ucs/ucs_mac_pool.py deleted file mode 100644 index ddd9fcf8710..00000000000 --- a/lib/ansible/modules/remote_management/ucs/ucs_mac_pool.py +++ /dev/null @@ -1,185 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'certified'} - -DOCUMENTATION = r''' ---- -module: ucs_mac_pool -short_description: Configures MAC address pools on Cisco UCS Manager -description: -- Configures MAC address pools and MAC address blocks on Cisco UCS Manager. -extends_documentation_fragment: ucs -options: - state: - description: - - If C(present), will verify MAC pool is present and will create if needed. - - If C(absent), will verify MAC pool is absent and will delete if needed. - choices: [present, absent] - default: present - name: - description: - - The name of the MAC pool. - - This name can be between 1 and 32 alphanumeric characters. - - "You cannot use spaces or any special characters other than - (hyphen), \"_\" (underscore), : (colon), and . (period)." - - You cannot change this name after the MAC pool is created. - required: yes - description: - description: - - A description of the MAC pool. - - 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, descrption ] - order: - description: - - The Assignment Order field. - - "This can be one of the following:" - - "default - Cisco UCS Manager selects a random identity from the pool." - - "sequential - Cisco UCS Manager selects the lowest available identity from the pool." - choices: [default, sequential] - default: default - first_addr: - description: - - The first MAC address in the block of addresses. - - This is the From field in the UCS Manager MAC Blocks menu. - last_addr: - description: - - The last MAC address in the block of addresses. - - This is the To field in the UCS Manager Add MAC Blocks menu. - org_dn: - description: - - The distinguished name (dn) of the organization where the resource is assigned. - default: org-root -requirements: -- ucsmsdk -author: -- David Soper (@dsoper2) -- CiscoUcs (@CiscoUcs) -version_added: '2.5' -''' - -EXAMPLES = r''' -- name: Configure MAC address pool - ucs_mac_pool: - hostname: 172.16.143.150 - username: admin - password: password - name: mac-A - first_addr: 00:25:B5:00:66:00 - last_addr: 00:25:B5:00:67:F3 - order: sequential - -- name: Remove MAC address pool - ucs_mac_pool: - hostname: 172.16.143.150 - username: admin - password: password - name: mac-A - state: absent -''' - -RETURN = r''' -# -''' - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.remote_management.ucs import UCSModule, ucs_argument_spec - - -def main(): - argument_spec = ucs_argument_spec - argument_spec.update( - org_dn=dict(type='str', default='org-root'), - name=dict(type='str', required=True), - descr=dict(type='str', default='', aliases=['description', 'descrption']), - order=dict(type='str', default='default', choices=['default', 'sequential']), - first_addr=dict(type='str'), - last_addr=dict(type='str'), - state=dict(default='present', choices=['present', 'absent'], type='str'), - ) - module = AnsibleModule( - argument_spec, - supports_check_mode=True, - ) - # UCSModule verifies ucsmsdk is present and exits on failure. Imports are below ucs object creation. - ucs = UCSModule(module) - - err = False - - from ucsmsdk.mometa.macpool.MacpoolPool import MacpoolPool - from ucsmsdk.mometa.macpool.MacpoolBlock import MacpoolBlock - - changed = False - try: - mo_exists = False - props_match = False - # dn is /mac-pool- - dn = module.params['org_dn'] + '/mac-pool-' + module.params['name'] - mo = ucs.login_handle.query_dn(dn) - if mo: - mo_exists = True - - if module.params['state'] == 'absent': - if mo_exists: - if not module.check_mode: - ucs.login_handle.remove_mo(mo) - ucs.login_handle.commit() - changed = True - else: - if mo_exists: - # check top-level mo props - kwargs = dict(assignment_order=module.params['order']) - kwargs['descr'] = module.params['descr'] - if (mo.check_prop_match(**kwargs)): - # top-level props match, check next level mo/props - if module.params['last_addr'] and module.params['first_addr']: - # mac address block specified, check properties - block_dn = dn + '/block-' + module.params['first_addr'].upper() + '-' + module.params['last_addr'].upper() - mo_1 = ucs.login_handle.query_dn(block_dn) - if mo_1: - props_match = True - else: - # no MAC address block specified, but top-level props matched - props_match = True - - if not props_match: - if not module.check_mode: - # create if mo does not already exist - mo = MacpoolPool( - parent_mo_or_dn=module.params['org_dn'], - name=module.params['name'], - descr=module.params['descr'], - assignment_order=module.params['order'], - ) - - if module.params['last_addr'] and module.params['first_addr']: - mo_1 = MacpoolBlock( - parent_mo_or_dn=mo, - to=module.params['last_addr'], - r_from=module.params['first_addr'], - ) - - ucs.login_handle.add_mo(mo, True) - ucs.login_handle.commit() - changed = True - - except Exception as e: - err = True - ucs.result['msg'] = "setup error: %s " % str(e) - - ucs.result['changed'] = changed - if err: - module.fail_json(**ucs.result) - module.exit_json(**ucs.result) - - -if __name__ == '__main__': - main() diff --git a/lib/ansible/modules/remote_management/ucs/ucs_managed_objects.py b/lib/ansible/modules/remote_management/ucs/ucs_managed_objects.py deleted file mode 100644 index 965207af78b..00000000000 --- a/lib/ansible/modules/remote_management/ucs/ucs_managed_objects.py +++ /dev/null @@ -1,263 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} - -DOCUMENTATION = r''' ---- -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/). -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' -''' - -EXAMPLES = r''' -- 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 - - -''' - -RETURN = r''' -# -''' - -import traceback - -IMPORT_IMP_ERR = None -try: - from importlib import import_module - HAS_IMPORT_MODULE = True -except Exception: - IMPORT_IMP_ERR = traceback.format_exc() - HAS_IMPORT_MODULE = False - -from copy import deepcopy -import json -from ansible.module_utils.basic import AnsibleModule, missing_required_lib -from ansible.module_utils.remote_management.ucs import UCSModule, ucs_argument_spec - - -def traverse_objects(module, ucs, managed_object, mo=''): - props_match = False - - mo_module = import_module(managed_object['module']) - mo_class = getattr(mo_module, managed_object['class']) - - if not managed_object['properties'].get('parent_mo_or_dn'): - managed_object['properties']['parent_mo_or_dn'] = mo - - mo = mo_class(**managed_object['properties']) - - existing_mo = ucs.login_handle.query_dn(mo.dn) - - if module.params['state'] == 'absent': - # mo must exist, but all properties do not have to match - if existing_mo: - if not module.check_mode: - ucs.login_handle.remove_mo(existing_mo) - ucs.login_handle.commit() - ucs.result['changed'] = True - else: - if existing_mo: - # check mo props - kwargs = dict(managed_object['properties']) - # remove parent info and passwords because those aren't presented in the actual props - kwargs.pop('parent_mo_or_dn', None) - kwargs.pop('pwd', None) - kwargs.pop('password', None) - if existing_mo.check_prop_match(**kwargs): - props_match = True - - if not props_match: - if not module.check_mode: - try: - ucs.login_handle.add_mo(mo, modify_present=True) - ucs.login_handle.commit() - except Exception as e: - ucs.result['err'] = True - ucs.result['msg'] = "setup error: %s " % str(e) - - ucs.result['changed'] = True - - if managed_object.get('children'): - for child in managed_object['children']: - # explicit deep copy of child object since traverse_objects may modify parent mo information - copy_of_child = deepcopy(child) - traverse_objects(module, ucs, copy_of_child, mo) - - -def main(): - object_dict = dict( - module=dict(type='str', required=True), - class_name=dict(type='str', aliases=['class'], required=True), - properties=dict(type='dict', required=True), - children=dict(type='list'), - ) - argument_spec = ucs_argument_spec - argument_spec.update( - objects=dict(type='list', elements='dict', options=object_dict, required=True), - state=dict(type='str', choices=['present', 'absent'], default='present'), - ) - - module = AnsibleModule( - argument_spec, - supports_check_mode=True, - ) - - if not HAS_IMPORT_MODULE: - module.fail_json(msg=missing_required_lib('importlib'), exception=IMPORT_IMP_ERR) - ucs = UCSModule(module) - - ucs.result['err'] = False - # note that all objects specified in the object list report a single result (including a single changed). - ucs.result['changed'] = False - - for managed_object in module.params['objects']: - traverse_objects(module, ucs, managed_object) - - if ucs.result['err']: - module.fail_json(**ucs.result) - module.exit_json(**ucs.result) - - -if __name__ == '__main__': - main() diff --git a/lib/ansible/modules/remote_management/ucs/ucs_ntp_server.py b/lib/ansible/modules/remote_management/ucs/ucs_ntp_server.py deleted file mode 100644 index 096c13915bb..00000000000 --- a/lib/ansible/modules/remote_management/ucs/ucs_ntp_server.py +++ /dev/null @@ -1,169 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'certified'} - -DOCUMENTATION = r''' ---- -module: ucs_ntp_server -short_description: Configures NTP server on Cisco UCS Manager -extends_documentation_fragment: -- ucs -description: -- Configures NTP server on Cisco UCS Manager. -options: - state: - description: - - If C(absent), will remove an NTP server. - - If C(present), will add or update an NTP server. - choices: [absent, present] - default: present - - ntp_server: - description: - - NTP server IP address or hostname. - - Enter up to 63 characters that form a valid hostname. - - Enter a valid IPV4 Address. - aliases: [ name ] - default: "" - - description: - description: - - A user-defined description of the NTP server. - - 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 ] - default: "" - -requirements: -- ucsmsdk -author: -- John McDonough (@movinalot) -- CiscoUcs (@CiscoUcs) -version_added: "2.7" -''' - -EXAMPLES = r''' -- name: Configure NTP server - ucs_ntp_server: - hostname: 172.16.143.150 - username: admin - password: password - ntp_server: 10.10.10.10 - description: Internal NTP Server by IP address - state: present - -- name: Configure NTP server - ucs_ntp_server: - hostname: 172.16.143.150 - username: admin - password: password - ntp_server: pool.ntp.org - description: External NTP Server by hostname - state: present - -- name: Remove NTP server - ucs_ntp_server: - hostname: 172.16.143.150 - username: admin - password: password - ntp_server: 10.10.10.10 - state: absent - -- name: Remove NTP server - ucs_ntp_server: - hostname: 172.16.143.150 - username: admin - password: password - ntp_server: pool.ntp.org - state: absent -''' - -RETURN = r''' -# -''' - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.remote_management.ucs import UCSModule, ucs_argument_spec - - -def run_module(): - argument_spec = ucs_argument_spec - argument_spec.update( - ntp_server=dict(type='str', aliases=['name']), - description=dict(type='str', aliases=['descr'], default=''), - state=dict(type='str', default='present', choices=['present', 'absent']), - ) - - module = AnsibleModule( - argument_spec, - supports_check_mode=True, - required_if=[ - ['state', 'present', ['ntp_server']], - ], - ) - # UCSModule verifies ucsmsdk is present and exits on failure. Imports are below ucs object creation. - ucs = UCSModule(module) - - err = False - - from ucsmsdk.mometa.comm.CommNtpProvider import CommNtpProvider - - changed = False - try: - mo_exists = False - props_match = False - - dn = 'sys/svc-ext/datetime-svc/ntp-' + module.params['ntp_server'] - - mo = ucs.login_handle.query_dn(dn) - if mo: - mo_exists = True - - if module.params['state'] == 'absent': - if mo_exists: - if not module.check_mode: - ucs.login_handle.remove_mo(mo) - ucs.login_handle.commit() - changed = True - else: - if mo_exists: - # check top-level mo props - kwargs = dict(descr=module.params['description']) - if mo.check_prop_match(**kwargs): - props_match = True - - if not props_match: - if not module.check_mode: - # update/add mo - mo = CommNtpProvider(parent_mo_or_dn='sys/svc-ext/datetime-svc', - name=module.params['ntp_server'], - descr=module.params['description']) - ucs.login_handle.add_mo(mo, modify_present=True) - ucs.login_handle.commit() - changed = True - - except Exception as e: - err = True - ucs.result['msg'] = "setup error: %s " % str(e) - - ucs.result['changed'] = changed - if err: - module.fail_json(**ucs.result) - module.exit_json(**ucs.result) - - -def main(): - run_module() - - -if __name__ == '__main__': - main() diff --git a/lib/ansible/modules/remote_management/ucs/ucs_org.py b/lib/ansible/modules/remote_management/ucs/ucs_org.py deleted file mode 100644 index df0ba1961b1..00000000000 --- a/lib/ansible/modules/remote_management/ucs/ucs_org.py +++ /dev/null @@ -1,225 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} - -DOCUMENTATION = r''' ---- -module: ucs_org - -short_description: Manages UCS Organizations for UCS Manager - -description: - - Manages UCS Organizations for UCS Manager. - -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" -''' - -EXAMPLES = r''' -- 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 -''' - -RETURN = r''' -# -''' - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.remote_management.ucs import UCSModule, ucs_argument_spec - - -def main(): - argument_spec = ucs_argument_spec - argument_spec.update( - org_name=dict(type='str', aliases=['name']), - parent_org_path=dict(type='str', default='root'), - description=dict(type='str', aliases=['descr']), - state=dict(type='str', default='present', choices=['present', 'absent']), - delegate_to=dict(type='str', default='localhost'), - ) - - module = AnsibleModule( - argument_spec, - supports_check_mode=True, - required_if=[ - ['state', 'present', ['org_name']], - ], - ) - - # UCSModule verifies ucsmsdk is present and exits on failure. - # Imports are below for UCS object creation. - ucs = UCSModule(module) - from ucsmsdk.mometa.org.OrgOrg import OrgOrg - - err = False - changed = False - requested_state = module.params['state'] - - kwargs = dict() - - if module.params['description'] is not None: - kwargs['descr'] = module.params['description'] - - try: - parent_org_dn = 'org-' + module.params['parent_org_path'].replace('/', '/org-') - dn = parent_org_dn + '/org-' + module.params['org_name'] - - mo = ucs.login_handle.query_dn(dn) - - # Determine state change - if mo: - # Object exists, if it should exist has anything changed? - if requested_state == 'present': - # Do some or all Object properties not match, that is a change - if not mo.check_prop_match(**kwargs): - changed = True - - # Object does not exist but should, that is a change - else: - if requested_state == 'present': - changed = True - - # Object exists but should not, that is a change - if mo and requested_state == 'absent': - changed = True - - # Apply state if not check_mode - if changed and not module.check_mode: - if requested_state == 'absent': - ucs.login_handle.remove_mo(mo) - else: - kwargs['parent_mo_or_dn'] = parent_org_dn - kwargs['name'] = module.params['org_name'] - if module.params['description'] is not None: - kwargs['descr'] = module.params['description'] - - mo = OrgOrg(**kwargs) - ucs.login_handle.add_mo(mo, modify_present=True) - ucs.login_handle.commit() - - except Exception as e: - err = True - ucs.result['msg'] = "setup error: %s " % str(e) - - ucs.result['changed'] = changed - if err: - module.fail_json(**ucs.result) - - module.exit_json(**ucs.result) - - -if __name__ == '__main__': - main() diff --git a/lib/ansible/modules/remote_management/ucs/ucs_query.py b/lib/ansible/modules/remote_management/ucs/ucs_query.py deleted file mode 100644 index 0736e24ae04..00000000000 --- a/lib/ansible/modules/remote_management/ucs/ucs_query.py +++ /dev/null @@ -1,171 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} - -DOCUMENTATION = r''' ---- -module: ucs_query - -short_description: Queries UCS Manager objects by class or distinguished name - -description: - -Queries UCS Manager objects by class or distinguished name. - -extends_documentation_fragment: ucs - -options: - class_ids: - description: - - One or more UCS Manager Class IDs to query. - - As a comma separated list - type: str - - distinguished_names: - description: - - One or more UCS Manager Distinguished Names to query. - - As a comma separated list - 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.10" -''' - -EXAMPLES = r''' -- name: Query UCS Class ID - ucs_query: - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - class_ids: computeBlade - delegate_to: localhost - -- name: Query UCS Class IDs - ucs_query: - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - class_ids: computeBlade, fabricVlan - delegate_to: localhost - -- name: Query UCS Distinguished Name - ucs_query: - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - distinguished_names: org-root - delegate_to: localhost - -- name: Query UCS Distinguished Names - ucs_query: - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - distinguished_names: org-root, sys/rack-unit-1, sys/chassis-1/blade-2 - delegate_to: localhost -''' - -RETURN = r''' -# -''' - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.remote_management.ucs import UCSModule, ucs_argument_spec - - -def retrieve_class_id(class_id, ucs): - return ucs.login_handle.query_classid(class_id) - - -def retrieve_distinguished_name(distinguished_name, ucs): - return ucs.login_handle.query_dn(distinguished_name) - - -def make_mo_dict(ucs_mo): - obj_dict = {} - for mo_property in ucs_mo.prop_map.values(): - obj_dict[mo_property] = getattr(ucs_mo, mo_property) - return obj_dict - - -def main(): - argument_spec = ucs_argument_spec - argument_spec.update( - class_ids=dict(type='str'), - distinguished_names=dict(type='str'), - delegate_to=dict(type='str', default='localhost'), - ) - - module = AnsibleModule( - argument_spec, - supports_check_mode=False, - mutually_exclusive=[ - ['class_ids', 'distinguished_names'], - ], - ) - - # UCSModule verifies ucsmsdk is present and exits on failure. - # Imports are below for UCS object creation. - ucs = UCSModule(module) - err = False - query_result = {} - - try: - if module.params['class_ids']: - class_ids = [ - x.strip() for x in module.params['class_ids'].split(',') - ] - for class_id in class_ids: - query_result[class_id] = [] - ucs_mos = retrieve_class_id(class_id, ucs) - if ucs_mos: - for ucs_mo in ucs_mos: - query_result[class_id].append(make_mo_dict(ucs_mo)) - - ucs.result['objects'] = query_result - - elif module.params['distinguished_names']: - distinguished_names = [ - x.strip() - for x in module.params['distinguished_names'].split(',') - ] - for distinguished_name in distinguished_names: - query_result[distinguished_name] = {} - ucs_mo = retrieve_distinguished_name(distinguished_name, ucs) - - if ucs_mo: - query_result[distinguished_name] = make_mo_dict(ucs_mo) - - ucs.result['objects'] = query_result - - except Exception as e: - err = True - ucs.result['msg'] = "setup error: %s " % str(e) - - if err: - module.fail_json(**ucs.result) - - ucs.result['changed'] = False - module.exit_json(**ucs.result) - - -if __name__ == '__main__': - main() diff --git a/lib/ansible/modules/remote_management/ucs/ucs_san_connectivity.py b/lib/ansible/modules/remote_management/ucs/ucs_san_connectivity.py deleted file mode 100644 index 2f12092a58b..00000000000 --- a/lib/ansible/modules/remote_management/ucs/ucs_san_connectivity.py +++ /dev/null @@ -1,247 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'certified'} - -DOCUMENTATION = r''' ---- -module: ucs_san_connectivity -short_description: Configures SAN Connectivity Policies on Cisco UCS Manager -description: -- Configures SAN Connectivity Policies on Cisco UCS Manager. -extends_documentation_fragment: ucs -options: - state: - description: - - If C(present), will verify SAN Connectivity Policies are present and will create if needed. - - If C(absent), will verify SAN Connectivity Policies are absent and will delete if needed. - choices: [present, absent] - default: present - name: - description: - - The name of the SAN 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 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 ] - wwnn_pool: - description: - - Name of the WWNN pool to use for WWNN assignment. - default: default - vhba_list: - description: - - List of vHBAs used by the SAN Connectivity Policy. - - vHBAs used by the SAN Connectivity Policy must be created from a vHBA template. - - "Each list element has the following suboptions:" - - "= name" - - " The name of the virtual HBA (required)." - - "= vhba_template" - - " The name of the virtual HBA template (required)." - - "- adapter_policy" - - " The name of the Fibre Channel adapter policy." - - " A user defined policy can be used, or one of the system defined policies (default, Linux, Solaris, VMware, Windows, WindowsBoot)" - - " [Default: default]" - - "- order" - - " String specifying the vHBA assignment order (e.g., '1', '2')." - - " [Default: unspecified]" - org_dn: - description: - - Org dn (distinguished name) - default: org-root -requirements: -- ucsmsdk -author: -- David Soper (@dsoper2) -- CiscoUcs (@CiscoUcs) -version_added: '2.5' -''' - -EXAMPLES = r''' -- name: Configure SAN Connectivity Policy - ucs_san_connectivity: - hostname: 172.16.143.150 - username: admin - password: password - name: Cntr-FC-Boot - wwnn_pool: WWNN-Pool - vhba_list: - - name: Fabric-A - vhba_template: vHBA-Template-A - adapter_policy: Linux - - name: Fabric-B - vhba_template: vHBA-Template-B - adapter_policy: Linux - -- name: Remove SAN Connectivity Policy - ucs_san_connectivity: - hostname: 172.16.143.150 - username: admin - password: password - name: Cntr-FC-Boot - state: absent -''' - -RETURN = r''' -# -''' - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.remote_management.ucs import UCSModule, ucs_argument_spec - - -def main(): - argument_spec = ucs_argument_spec - argument_spec.update( - org_dn=dict(type='str', default='org-root'), - name=dict(type='str'), - descr=dict(type='str'), - wwnn_pool=dict(type='str', default='default'), - vhba_list=dict(type='list'), - state=dict(type='str', default='present', choices=['present', 'absent']), - san_connectivity_list=dict(type='list'), - ) - - # Note that use of san_connectivity_list is an experimental feature which allows multiple resource updates with a single UCSM connection. - # Support for san_connectivity_list may change or be removed once persistent UCS connections are supported. - # Either san_connectivity_list or name is required (user can specify either a list or single resource). - - module = AnsibleModule( - argument_spec, - supports_check_mode=True, - required_one_of=[ - ['san_connectivity_list', 'name'], - ], - mutually_exclusive=[ - ['san_connectivity_list', 'name'], - ], - ) - ucs = UCSModule(module) - - err = False - - from ucsmsdk.mometa.vnic.VnicSanConnPolicy import VnicSanConnPolicy - from ucsmsdk.mometa.vnic.VnicFcNode import VnicFcNode - from ucsmsdk.mometa.vnic.VnicFc import VnicFc - from ucsmsdk.mometa.vnic.VnicFcIf import VnicFcIf - - changed = False - try: - # Only documented use is a single resource, but to also support experimental - # feature allowing multiple updates all params are converted to a san_connectivity_list below. - - if module.params['san_connectivity_list']: - # directly use the list (single resource and list are mutually exclusive - san_connectivity_list = module.params['san_connectivity_list'] - else: - # single resource specified, create list from the current params - san_connectivity_list = [module.params] - for san_connectivity in san_connectivity_list: - mo_exists = False - props_match = False - # set default params. Done here to set values for lists which can't be done in the argument_spec - if not san_connectivity.get('descr'): - san_connectivity['descr'] = '' - if not san_connectivity.get('wwnn_pool'): - san_connectivity['wwnn_pool'] = 'default' - if san_connectivity.get('vhba_list'): - for vhba in san_connectivity['vhba_list']: - if not vhba.get('adapter_policy'): - vhba['adapter_policy'] = '' - if not vhba.get('order'): - vhba['order'] = 'unspecified' - # dn is /san-conn-pol- - dn = module.params['org_dn'] + '/san-conn-pol-' + san_connectivity['name'] - - mo = ucs.login_handle.query_dn(dn) - if mo: - mo_exists = True - # check top-level mo props - kwargs = dict(descr=san_connectivity['descr']) - if (mo.check_prop_match(**kwargs)): - # top-level props match, check next level mo/props - # vnicFcNode object - child_dn = dn + '/fc-node' - mo_1 = ucs.login_handle.query_dn(child_dn) - if mo_1: - kwargs = dict(ident_pool_name=san_connectivity['wwnn_pool']) - if (mo_1.check_prop_match(**kwargs)): - if not san_connectivity.get('vhba_list'): - props_match = True - else: - # check vnicFc props - for vhba in san_connectivity['vhba_list']: - child_dn = dn + '/fc-' + vhba['name'] - mo_2 = ucs.login_handle.query_dn(child_dn) - kwargs = {} - kwargs['adaptor_profile_name'] = vhba['adapter_policy'] - kwargs['order'] = vhba['order'] - kwargs['nw_templ_name'] = vhba['vhba_template'] - if (mo_2.check_prop_match(**kwargs)): - props_match = True - - if module.params['state'] == 'absent': - # mo must exist but all properties do not have to match - if mo_exists: - if not module.check_mode: - ucs.login_handle.remove_mo(mo) - ucs.login_handle.commit() - changed = True - else: - if not props_match: - if not module.check_mode: - # create if mo does not already exist - mo = VnicSanConnPolicy( - parent_mo_or_dn=module.params['org_dn'], - name=san_connectivity['name'], - descr=san_connectivity['descr'], - ) - mo_1 = VnicFcNode( - parent_mo_or_dn=mo, - ident_pool_name=san_connectivity['wwnn_pool'], - addr='pool-derived', - ) - if san_connectivity.get('vhba_list'): - for vhba in san_connectivity['vhba_list']: - mo_2 = VnicFc( - parent_mo_or_dn=mo, - name=vhba['name'], - adaptor_profile_name=vhba['adapter_policy'], - nw_templ_name=vhba['vhba_template'], - order=vhba['order'], - ) - mo_2_1 = VnicFcIf( - parent_mo_or_dn=mo_2, - name='default', - ) - - ucs.login_handle.add_mo(mo, True) - ucs.login_handle.commit() - changed = True - - except Exception as e: - err = True - ucs.result['msg'] = "setup error: %s " % str(e) - - ucs.result['changed'] = changed - if err: - module.fail_json(**ucs.result) - module.exit_json(**ucs.result) - - -if __name__ == '__main__': - main() diff --git a/lib/ansible/modules/remote_management/ucs/ucs_service_profile_template.py b/lib/ansible/modules/remote_management/ucs/ucs_service_profile_template.py deleted file mode 100644 index 8a900df8373..00000000000 --- a/lib/ansible/modules/remote_management/ucs/ucs_service_profile_template.py +++ /dev/null @@ -1,516 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} - -DOCUMENTATION = r''' ---- -module: ucs_service_profile_template -short_description: Configures Service Profile Templates on Cisco UCS Manager -description: -- Configures Service Profile Templates on Cisco UCS Manager. -extends_documentation_fragment: ucs -options: - state: - description: - - If C(present), will verify Service Profile Templates are present and will create if needed. - - If C(absent), will verify Service Profile Templates are absent and will delete if needed. - choices: [present, absent] - default: present - name: - description: - - The name of the service profile template. - - This name can be between 2 and 32 alphanumeric characters. - - "You cannot use spaces or any special characters other than - (hyphen), \"_\" (underscore), : (colon), and . (period)." - - This name must be unique across all service profiles and service profile templates within the same organization. - required: yes - template_type: - description: - - "The template type field which can be one of the following:" - - "initial-template — Any service profiles created from this template are not updated if the template changes." - - "updating-template — Any service profiles created from this template are updated if the template changes." - choices: [initial-template, updating-template] - default: initial-template - uuid_pool: - description: - - Specifies how the UUID will be set on a server associated with a service profile created from this template. - - "The uuid_pool option can be the name of the UUID pool to use or '' (the empty string)." - - An empty string will use the UUID assigned to the server by the manufacturer, and the - - UUID remains unassigned until a service profile created from this template is associated with a server. At that point, - - the UUID is set to the UUID value assigned to the server by the manufacturer. If the service profile is later moved to - - a different server, the UUID is changed to match the new server." - default: default - description: - description: - - A user-defined description of the service profile template. - - 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 ] - storage_profile: - description: - - The name of the storage profile you want to associate with service profiles created from this template - local_disk_policy: - description: - - The name of the local disk policy you want to associate with service profiles created from this template. - lan_connectivity_policy: - description: - - The name of the LAN connectivity policy you want to associate with service profiles created from this template. - iqn_pool: - description: - - The name of the IQN pool (initiator) you want to apply to all iSCSI vNICs for service profiles created from this template. - san_connectivity_policy: - description: - - The name of the SAN connectivity policy you want to associate with service profiles created from this template. - vmedia_policy: - description: - - The name of the vMedia policy you want to associate with service profiles created from this template. - boot_policy: - description: - - The name of the boot order policy you want to associate with service profiles created from this template. - default: default - maintenance_policy: - description: - - The name of the maintenance policy you want to associate with service profiles created from this template. - server_pool: - description: - - The name of the server pool you want to associate with this service profile template. - server_pool_qualification: - description: - - The name of the server pool policy qualification you want to use for this service profile template. - power_state: - description: - - The power state to be applied when a service profile created from this template is associated with a server. - choices: [up, down] - default: up - host_firmware_package: - description: - - The name of the host firmware package you want to associate with service profiles created from this template. - bios_policy: - description: - - The name of the BIOS policy you want to associate with service profiles created from this template. - ipmi_access_profile: - description: - - The name of the IPMI access profile you want to associate with service profiles created from this template. - sol_policy: - description: - - The name of the Serial over LAN (SoL) policy you want to associate with service profiles created from this template. - mgmt_ip_pool: - description: - - The name of the management IP pool you want to use with service profiles created from this template. - default: ext-mgmt - power_control_policy: - description: - - The name of the power control policy you want to associate with service profiles created from this template. - default: default - power_sync_policy: - description: - - The name of the power sync policy you want to associate with service profiles created from this template. - scrub_policy: - description: - - The name of the scrub policy you want to associate with service profiles created from this template. - kvm_mgmt_policy: - description: - - The name of the KVM management policy you want to associate with service profiles created from this template. - graphics_card_policy: - description: - - The name of the graphics card policy you want to associate with service profiles created from this template. - threshold_policy: - description: - - The name of the threshold policy you want to associate with service profiles created from this template. - default: default - user_label: - description: - - The User Label you want to assign to service profiles created from this template. - mgmt_interface_mode: - description: - - The Management Interface you want to assign to service profiles created from this template. - choices: ['', in-band] - mgmt_vnet_name: - description: - - A VLAN selected from the associated VLAN group. - mgmt_inband_pool_name: - description: - - How the inband management IPv4 address is derived for the server associated with this service profile. - org_dn: - description: - - Org dn (distinguished name) - default: org-root -requirements: -- ucsmsdk -author: -- David Soper (@dsoper2) -- CiscoUcs (@CiscoUcs) -version_added: '2.8' -''' - -EXAMPLES = r''' -- name: Configure Service Profile Template with LAN/SAN Connectivity and all other options defaulted - ucs_service_profile_template: - hostname: 172.16.143.150 - username: admin - password: password - name: DEE-Ctrl - template_type: updating-template - uuid_pool: UUID-Pool - storage_profile: DEE-StgProf - lan_connectivity_policy: Cntr-FC-Boot - iqn_pool: iSCSI-Boot-A - san_connectivity_policy: Cntr-FC-Boot - boot_policy: DEE-vMedia - maintenance_policy: default - server_pool: Container-Pool - host_firmware_package: 3.1.2b - bios_policy: Docker - -- name: Remove Service Profile Template - ucs_service_profile_template: - hostname: 172.16.143.150 - username: admin - password: password - name: DEE-Ctrl - state: absent -''' - -RETURN = r''' -# -''' - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.remote_management.ucs import UCSModule, ucs_argument_spec - - -def configure_service_profile_template(ucs, module): - from ucsmsdk.mometa.ls.LsServer import LsServer - from ucsmsdk.mometa.vnic.VnicConnDef import VnicConnDef - from ucsmsdk.mometa.vnic.VnicIScsiNode import VnicIScsiNode - from ucsmsdk.mometa.ls.LsRequirement import LsRequirement - from ucsmsdk.mometa.ls.LsPower import LsPower - from ucsmsdk.mometa.lstorage.LstorageProfileBinding import LstorageProfileBinding - from ucsmsdk.mometa.mgmt.MgmtInterface import MgmtInterface - from ucsmsdk.mometa.mgmt.MgmtVnet import MgmtVnet - from ucsmsdk.mometa.vnic.VnicIpV4MgmtPooledAddr import VnicIpV4MgmtPooledAddr - - if not module.check_mode: - try: - # create if mo does not already exist - mo = LsServer( - parent_mo_or_dn=module.params['org_dn'], - bios_profile_name=module.params['bios_policy'], - boot_policy_name=module.params['boot_policy'], - descr=module.params['description'], - ext_ip_state='pooled', - ext_ip_pool_name=module.params['mgmt_ip_pool'], - # graphics_card_policy_name=module.params['graphics_card_policy'], - host_fw_policy_name=module.params['host_firmware_package'], - ident_pool_name=module.params['uuid_pool'], - kvm_mgmt_policy_name=module.params['kvm_mgmt_policy'], - local_disk_policy_name=module.params['local_disk_policy'], - maint_policy_name=module.params['maintenance_policy'], - mgmt_access_policy_name=module.params['ipmi_access_profile'], - name=module.params['name'], - power_policy_name=module.params['power_control_policy'], - power_sync_policy_name=module.params['power_sync_policy'], - scrub_policy_name=module.params['scrub_policy'], - sol_policy_name=module.params['sol_policy'], - stats_policy_name=module.params['threshold_policy'], - type=module.params['template_type'], - usr_lbl=module.params['user_label'], - vmedia_policy_name=module.params['vmedia_policy'], - ) - - if module.params['storage_profile']: - # Storage profile - mo_1 = LstorageProfileBinding( - parent_mo_or_dn=mo, - storage_profile_name=module.params['storage_profile'], - ) - - if module.params['mgmt_interface_mode']: - # Management Interface - mo_1 = MgmtInterface( - parent_mo_or_dn=mo, - mode=module.params['mgmt_interface_mode'], - ip_v4_state='pooled', - ) - mo_2 = MgmtVnet( - parent_mo_or_dn=mo_1, - id='1', - name=module.params['mgmt_vnet_name'], - ) - VnicIpV4MgmtPooledAddr( - parent_mo_or_dn=mo_2, - name=module.params['mgmt_inband_pool_name'], - ) - - # LAN/SAN connectivity policy - mo_1 = VnicConnDef( - parent_mo_or_dn=mo, - lan_conn_policy_name=module.params['lan_connectivity_policy'], - san_conn_policy_name=module.params['san_connectivity_policy'], - ) - - if module.params['iqn_pool']: - # IQN pool - mo_1 = VnicIScsiNode( - parent_mo_or_dn=mo, - iqn_ident_pool_name=module.params['iqn_pool'] - ) - - # power state - admin_state = 'admin-' + module.params['power_state'] - mo_1 = LsPower( - parent_mo_or_dn=mo, - state=admin_state, - ) - - if module.params['server_pool']: - # server pool - mo_1 = LsRequirement( - parent_mo_or_dn=mo, - name=module.params['server_pool'], - qualifier=module.params['server_pool_qualification'], - ) - - ucs.login_handle.add_mo(mo, True) - ucs.login_handle.commit() - except Exception as e: # generic Exception handling because SDK can throw a variety of exceptions - ucs.result['msg'] = "setup error: %s " % str(e) - module.fail_json(**ucs.result) - - ucs.result['changed'] = True - - -def check_storage_profile_props(ucs, module, dn): - props_match = False - - child_dn = dn + '/profile-binding' - mo_1 = ucs.login_handle.query_dn(child_dn) - if mo_1: - kwargs = dict(storage_profile_name=module.params['storage_profile']) - if mo_1.check_prop_match(**kwargs): - props_match = True - elif not module.params['storage_profile']: - # no storage profile mo or desired state - props_match = True - - return props_match - - -def check_connectivity_policy_props(ucs, module, dn): - props_match = False - - child_dn = dn + '/conn-def' - mo_1 = ucs.login_handle.query_dn(child_dn) - if mo_1: - kwargs = dict(lan_conn_policy_name=module.params['lan_connectivity_policy']) - kwargs['san_conn_policy_name'] = module.params['san_connectivity_policy'] - if mo_1.check_prop_match(**kwargs): - props_match = True - elif not module.params['lan_connectivity_policy'] and not module.params['san_connectivity_policy']: - # no mo and no desired state - props_match = True - - return props_match - - -def check_iqn_pool_props(ucs, module, dn): - props_match = False - - child_dn = dn + '/iscsi-node' - mo_1 = ucs.login_handle.query_dn(child_dn) - if mo_1: - kwargs = dict(iqn_ident_pool_name=module.params['iqn_pool']) - if mo_1.check_prop_match(**kwargs): - props_match = True - elif not module.params['iqn_pool']: - # no mo and no desired state - props_match = True - - return props_match - - -def check_inband_management_props(ucs, module, dn): - props_match = False - - child_dn = dn + '/iface-in-band' - mo_1 = ucs.login_handle.query_dn(child_dn) - if mo_1: - kwargs = dict(mode=module.params['mgmt_interface_mode']) - if mo_1.check_prop_match(**kwargs): - child_dn = child_dn + '/network' - mo_2 = ucs.login_handle.query_dn(child_dn) - if mo_2: - kwargs = dict(name=module.params['mgmt_vnet_name']) - if mo_2.check_prop_match(**kwargs): - child_dn = child_dn + '/ipv4-pooled-addr' - mo_3 = ucs.login_handle.query_dn(child_dn) - if mo_3: - kwargs = dict(name=module.params['mgmt_inband_pool_name']) - if mo_3.check_prop_match(**kwargs): - props_match = True - elif not module.params['mgmt_interface_mode']: - # no mo and no desired state - props_match = True - - return props_match - - -def check_power_props(ucs, module, dn): - props_match = False - - child_dn = dn + '/power' - mo_1 = ucs.login_handle.query_dn(child_dn) - if mo_1: - kwargs = dict(state=module.params['power_state']) - if mo_1.check_prop_match(**kwargs): - props_match = True - elif not module.params['power_state']: - # no mo and no desired state - props_match = True - - return props_match - - -def check_server_pool(ucs, module, dn): - props_match = False - - child_dn = dn + '/pn-req' - mo_1 = ucs.login_handle.query_dn(child_dn) - if mo_1: - kwargs = dict(name=module.params['server_pool']) - kwargs['qualifier'] = module.params['server_pool_qualification'] - if mo_1.check_prop_match(**kwargs): - props_match = True - elif not module.params['server_pool']: - # no pn-req object and no server pool name provided - props_match = True - - return props_match - - -def check_serivce_profile_templates_props(ucs, module, mo, dn): - props_match = False - - # check top-level mo props - kwargs = dict(bios_profile_name=module.params['bios_policy']) - kwargs['boot_policy_name'] = module.params['boot_policy'] - kwargs['descr'] = module.params['description'] - kwargs['ext_ip_pool_name'] = module.params['mgmt_ip_pool'] - # kwargs['graphics_card_policy_name'] = module.params['graphics_card_policy'] - kwargs['host_fw_policy_name'] = module.params['host_firmware_package'] - kwargs['ident_pool_name'] = module.params['uuid_pool'] - kwargs['kvm_mgmt_policy_name'] = module.params['kvm_mgmt_policy'] - kwargs['local_disk_policy_name'] = module.params['local_disk_policy'] - kwargs['maint_policy_name'] = module.params['maintenance_policy'] - kwargs['mgmt_access_policy_name'] = module.params['ipmi_access_profile'] - kwargs['power_policy_name'] = module.params['power_control_policy'] - kwargs['power_sync_policy_name'] = module.params['power_sync_policy'] - kwargs['scrub_policy_name'] = module.params['scrub_policy'] - kwargs['sol_policy_name'] = module.params['sol_policy'] - kwargs['stats_policy_name'] = module.params['threshold_policy'] - kwargs['type'] = module.params['template_type'] - kwargs['usr_lbl'] = module.params['user_label'] - kwargs['vmedia_policy_name'] = module.params['vmedia_policy'] - - if mo.check_prop_match(**kwargs): - # top-level props match, check next level mo/props - # code below should discontinue checks once any mismatch is found - - # check storage profile 1st - props_match = check_storage_profile_props(ucs, module, dn) - - if props_match: - props_match = check_connectivity_policy_props(ucs, module, dn) - - if props_match: - props_match = check_iqn_pool_props(ucs, module, dn) - - if props_match: - props_match = check_inband_management_props(ucs, module, dn) - - if props_match: - props_match = check_power_props(ucs, module, dn) - - if props_match: - props_match = check_server_pool(ucs, module, dn) - - return props_match - - -def main(): - argument_spec = ucs_argument_spec - argument_spec.update( - org_dn=dict(type='str', default='org-root'), - name=dict(type='str', required=True), - bios_policy=dict(type='str', default=''), - boot_policy=dict(type='str', default='default'), - description=dict(type='str', aliases=['descr'], default=''), - mgmt_ip_pool=dict(type='str', default='ext-mgmt'), - graphics_card_policy=dict(type='str', default=''), - host_firmware_package=dict(type='str', default=''), - uuid_pool=dict(type='str', default='default'), - kvm_mgmt_policy=dict(type='str', default=''), - local_disk_policy=dict(type='str', default=''), - maintenance_policy=dict(type='str', default=''), - ipmi_access_profile=dict(type='str', default=''), - power_control_policy=dict(type='str', default='default'), - power_sync_policy=dict(type='str', default=''), - scrub_policy=dict(type='str', default=''), - sol_policy=dict(type='str', default=''), - threshold_policy=dict(type='str', default='default'), - template_type=dict(type='str', default='initial-template', choices=['initial-template', 'updating-template']), - user_label=dict(type='str', default=''), - vmedia_policy=dict(type='str', default=''), - storage_profile=dict(type='str', default=''), - lan_connectivity_policy=dict(type='str', default=''), - iqn_pool=dict(type='str', default=''), - san_connectivity_policy=dict(type='str', default=''), - server_pool=dict(type='str', default=''), - server_pool_qualification=dict(type='str', default=''), - power_state=dict(type='str', default='up', choices=['up', 'down']), - mgmt_interface_mode=dict(type='str', default='', choices=['', 'in-band']), - mgmt_vnet_name=dict(type='str', default=''), - mgmt_inband_pool_name=dict(type='str', default=''), - state=dict(type='str', default='present', choices=['present', 'absent']), - ) - - module = AnsibleModule( - argument_spec, - supports_check_mode=True, - ) - ucs = UCSModule(module) - # UCSModule creation above verifies ucsmsdk is present and exits on failure. - # Additional imports are done below or in called functions. - - ucs.result['changed'] = False - props_match = False - # dn is /ls- - dn = module.params['org_dn'] + '/ls-' + module.params['name'] - - mo = ucs.login_handle.query_dn(dn) - if mo: - if module.params['state'] == 'absent': - # mo must exist but all properties do not have to match - if not module.check_mode: - ucs.login_handle.remove_mo(mo) - ucs.login_handle.commit() - ucs.result['changed'] = True - else: # state == 'present' - props_match = check_serivce_profile_templates_props(ucs, module, mo, dn) - - if module.params['state'] == 'present' and not props_match: - configure_service_profile_template(ucs, module) - - module.exit_json(**ucs.result) - - -if __name__ == '__main__': - main() diff --git a/lib/ansible/modules/remote_management/ucs/ucs_storage_profile.py b/lib/ansible/modules/remote_management/ucs/ucs_storage_profile.py deleted file mode 100644 index 7e1121fdcc5..00000000000 --- a/lib/ansible/modules/remote_management/ucs/ucs_storage_profile.py +++ /dev/null @@ -1,253 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'certified'} - -DOCUMENTATION = r''' ---- -module: ucs_storage_profile -short_description: Configures storage profiles on Cisco UCS Manager -description: -- Configures storage profiles on Cisco UCS Manager. -extends_documentation_fragment: ucs -options: - state: - description: - - If C(present), will verify that the storage profile is present and will create if needed. - - If C(absent), will verify that the storage profile is absent and will delete if needed. - choices: [ absent, present ] - default: present - name: - description: - - The name of the storage profile. - - 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 profile 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 ] - local_luns: - description: - - List of Local LUNs used by the storage profile. - suboptions: - name: - description: - - The name of the local LUN. - required: yes - size: - description: - - Size of this LUN in GB. - - The size can range from 1 to 10240 GB. - default: '1' - auto_deploy: - description: - - Whether the local LUN should be automatically deployed or not. - choices: [ auto-deploy, no-auto-deploy ] - default: auto-deploy - expand_to_avail: - description: - - Specifies that this LUN can be expanded to use the entire available disk group. - - For each service profile, only one LUN can use this option. - - Expand To Available option is not supported for already deployed LUN. - type: bool - default: 'no' - fractional_size: - description: - - Fractional size of this LUN in MB. - default: '0' - disk_policy_name: - description: - - The disk group configuration policy to be applied to this local LUN. - state: - description: - - If C(present), will verify local LUN is present on profile. - If C(absent), will verify local LUN is absent on profile. - choices: [ absent, present ] - default: present - 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) -version_added: '2.7' -''' - -EXAMPLES = r''' -- name: Configure Storage Profile - ucs_storage_profile: - hostname: 172.16.143.150 - username: admin - password: password - name: DEE-StgProf - local_luns: - - name: Boot-LUN - size: '60' - disk_policy_name: DEE-DG - - name: Data-LUN - size: '200' - disk_policy_name: DEE-DG - -- name: Remove Storage Profile - ucs_storage_profile: - hostname: 172.16.143.150 - username: admin - password: password - name: DEE-StgProf - state: absent - -- name: Remove Local LUN from Storage Profile - ucs_storage_profile: - hostname: 172.16.143.150 - username: admin - password: password - name: DEE-StgProf - local_luns: - - name: Data-LUN - state: absent -''' - -RETURN = r''' -# -''' - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.remote_management.ucs import UCSModule, ucs_argument_spec - - -def main(): - local_lun = dict( - name=dict(type='str', required=True), - state=dict(type='str', default='present', choices=['present', 'absent']), - size=dict(type='str', default='1'), - auto_deploy=dict(type='str', default='auto-deploy', choices=['auto-deploy', 'no-auto-deploy']), - expand_to_avail=dict(type='str', default='no', choices=['no', 'yes']), - fractional_size=dict(type='str', default='0'), - disk_policy_name=dict(type='str', default=''), - ) - argument_spec = ucs_argument_spec - argument_spec.update( - org_dn=dict(type='str', default='org-root'), - name=dict(type='str', required=True), - description=dict(type='str', aliases=['descr'], default=''), - local_luns=dict(type='list', elements='dict', options=local_lun), - state=dict(type='str', default='present', choices=['present', 'absent']), - ) - - module = AnsibleModule( - argument_spec, - supports_check_mode=True, - ) - ucs = UCSModule(module) - - err = False - - # UCSModule creation above verifies ucsmsdk is present and exits on failure. Additional imports are done below. - from ucsmsdk.mometa.lstorage.LstorageProfile import LstorageProfile - from ucsmsdk.mometa.lstorage.LstorageDasScsiLun import LstorageDasScsiLun - - ucs.result['changed'] = False - try: - mo_exists = False - props_match = False - # dn is /profile- - dn = module.params['org_dn'] + '/profile-' + module.params['name'] - - mo = ucs.login_handle.query_dn(dn) - if mo: - mo_exists = True - - if module.params['state'] == 'absent': - # mo must exist but all properties do not have to match - if mo_exists: - if not module.check_mode: - ucs.login_handle.remove_mo(mo) - ucs.login_handle.commit() - ucs.result['changed'] = True - else: - if mo_exists: - # check top-level mo props - kwargs = dict(descr=module.params['description']) - if mo.check_prop_match(**kwargs): - # top-level props match, check next level mo/props - if not module.params.get('local_luns'): - props_match = True - else: - # check local lun props - for lun in module.params['local_luns']: - child_dn = dn + '/das-scsi-lun-' + lun['name'] - mo_1 = ucs.login_handle.query_dn(child_dn) - if lun['state'] == 'absent': - if mo_1: - props_match = False - break - else: - if mo_1: - kwargs = dict(size=str(lun['size'])) - kwargs['auto_deploy'] = lun['auto_deploy'] - kwargs['expand_to_avail'] = lun['expand_to_avail'] - kwargs['fractional_size'] = str(lun['fractional_size']) - kwargs['local_disk_policy_name'] = lun['disk_policy_name'] - if mo_1.check_prop_match(**kwargs): - props_match = True - else: - props_match = False - break - - if not props_match: - if not module.check_mode: - # create if mo does not already exist - mo = LstorageProfile( - parent_mo_or_dn=module.params['org_dn'], - name=module.params['name'], - descr=module.params['description'], - ) - - if module.params.get('local_luns'): - for lun in module.params['local_luns']: - if lun['state'] == 'absent': - child_dn = dn + '/das-scsi-lun-' + lun['name'] - mo_1 = ucs.login_handle.query_dn(child_dn) - ucs.login_handle.remove_mo(mo_1) - else: - mo_1 = LstorageDasScsiLun( - parent_mo_or_dn=mo, - name=lun['name'], - size=str(lun['size']), - auto_deploy=lun['auto_deploy'], - expand_to_avail=lun['expand_to_avail'], - fractional_size=str(lun['fractional_size']), - local_disk_policy_name=lun['disk_policy_name'], - ) - - ucs.login_handle.add_mo(mo, True) - ucs.login_handle.commit() - ucs.result['changed'] = True - - except Exception as e: - err = True - ucs.result['msg'] = "setup error: %s " % str(e) - - if err: - module.fail_json(**ucs.result) - module.exit_json(**ucs.result) - - -if __name__ == '__main__': - main() diff --git a/lib/ansible/modules/remote_management/ucs/ucs_timezone.py b/lib/ansible/modules/remote_management/ucs/ucs_timezone.py deleted file mode 100644 index 9abf83718e9..00000000000 --- a/lib/ansible/modules/remote_management/ucs/ucs_timezone.py +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'certified'} - -DOCUMENTATION = r''' ---- -module: ucs_timezone -short_description: Configures timezone on Cisco UCS Manager -description: -- Configures timezone on Cisco UCS Manager. -extends_documentation_fragment: ucs -options: - state: - description: - - If C(absent), will unset timezone. - - If C(present), will set or update timezone. - choices: [absent, present] - default: present - - admin_state: - description: - - The admin_state setting - - The enabled admin_state indicates the timezone configuration is utilized by UCS Manager. - - The disabled admin_state indicates the timezone configuration is ignored by UCS Manager. - choices: [disabled, enabled] - default: enabled - - description: - description: - - A user-defined description of the timezone. - - 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 ] - default: "" - - timezone: - description: - - The timezone name. - - Time zone names are from the L(tz database,https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) - - The timezone name is case sensitive. - - The timezone name can be between 0 and 510 alphanumeric characters. - - You cannot use spaces or any special characters other than - - "\"-\" (hyphen), \"_\" (underscore), \"/\" (backslash)." - -requirements: -- ucsmsdk -author: -- John McDonough (@movinalot) -- CiscoUcs (@CiscoUcs) -version_added: '2.7' -''' - -EXAMPLES = r''' -- name: Configure Time Zone - ucs_timezone: - hostname: 172.16.143.150 - username: admin - password: password - state: present - admin_state: enabled - timezone: America/Los_Angeles - description: 'Time Zone for Los Angeles' - -- name: Unconfigure Time Zone - ucs_timezone: - hostname: 172.16.143.150 - username: admin - password: password - state: absent - admin_state: disabled -''' - -RETURN = r''' -# -''' - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.remote_management.ucs import UCSModule, ucs_argument_spec - - -def run_module(): - argument_spec = ucs_argument_spec - argument_spec.update( - timezone=dict(type='str'), - description=dict(type='str', aliases=['descr'], default=''), - admin_state=dict(type='str', default='enabled', choices=['disabled', 'enabled']), - state=dict(type='str', default='present', choices=['present', 'absent']), - ) - - module = AnsibleModule( - argument_spec, - supports_check_mode=True, - required_if=[ - ['state', 'present', ['timezone']], - ], - ) - ucs = UCSModule(module) - - err = False - - changed = False - try: - mo_exists = False - props_match = False - - dn = 'sys/svc-ext/datetime-svc' - - mo = ucs.login_handle.query_dn(dn) - if mo: - mo_exists = True - - if module.params['state'] == 'absent': - # mo must exist but all properties do not have to match - if mo_exists: - if not module.check_mode: - mo.timezone = "" - mo.descr = "" - ucs.login_handle.add_mo(mo, modify_present=True) - ucs.login_handle.commit() - changed = True - else: - if mo_exists: - # check top-level mo props - kwargs = dict(descr=module.params['description']) - kwargs['timezone'] = module.params['timezone'] - kwargs['admin_state'] = module.params['admin_state'] - if mo.check_prop_match(**kwargs): - props_match = True - - if not props_match: - if not module.check_mode: - # update mo, timezone mo always exists - mo.timezone = module.params['timezone'] - mo.descr = module.params['description'] - mo.admin_state = module.params['admin_state'] - ucs.login_handle.add_mo(mo, modify_present=True) - ucs.login_handle.commit() - changed = True - - except Exception as e: - err = True - ucs.result['msg'] = "setup error: %s " % str(e) - - ucs.result['changed'] = changed - if err: - module.fail_json(**ucs.result) - module.exit_json(**ucs.result) - - -def main(): - run_module() - - -if __name__ == '__main__': - main() diff --git a/lib/ansible/modules/remote_management/ucs/ucs_uuid_pool.py b/lib/ansible/modules/remote_management/ucs/ucs_uuid_pool.py deleted file mode 100644 index b2a67569cf6..00000000000 --- a/lib/ansible/modules/remote_management/ucs/ucs_uuid_pool.py +++ /dev/null @@ -1,196 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'certified'} - -DOCUMENTATION = r''' ---- -module: ucs_uuid_pool -short_description: Configures server UUID pools on Cisco UCS Manager -description: -- Configures server UUID pools and UUID blocks on Cisco UCS Manager. -extends_documentation_fragment: ucs -options: - state: - description: - - If C(present), will verify UUID pool is present and will create if needed. - - If C(absent), will verify UUID pool is absent and will delete if needed. - choices: [present, absent] - default: present - name: - description: - - The name of the UUID pool. - - This name can be between 1 and 32 alphanumeric characters. - - "You cannot use spaces or any special characters other than - (hyphen), \"_\" (underscore), : (colon), and . (period)." - - You cannot change this name after the UUID pool is created. - required: yes - description: - description: - - "The user-defined description of the UUID pool." - - 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 ] - prefix: - description: - - UUID prefix used for the range of server UUIDs. - - "If no value is provided, the system derived prefix will be used (equivalent to selecting 'derived' option in UI)." - - "If the user provides a value, the user provided prefix will be used (equivalent to selecting 'other' option in UI)." - - A user provided value should be in the format XXXXXXXX-XXXX-XXXX. - order: - description: - - The Assignment Order field. - - "This can be one of the following:" - - "default - Cisco UCS Manager selects a random identity from the pool." - - "sequential - Cisco UCS Manager selects the lowest available identity from the pool." - choices: [default, sequential] - default: default - first_uuid: - description: - - The first UUID in the block of UUIDs. - - This is the From field in the UCS Manager UUID Blocks menu. - last_uuid: - description: - - The last UUID in the block of UUIDs. - - This is the To field in the UCS Manager Add UUID Blocks menu. - org_dn: - description: - - The distinguished name (dn) of the organization where the resource is assigned. - default: org-root -requirements: -- ucsmsdk -author: -- David Soper (@dsoper2) -- CiscoUcs (@CiscoUcs) -version_added: '2.7' -''' - -EXAMPLES = r''' -- name: Configure UUID address pool - ucs_uuid_pool: - hostname: 172.16.143.150 - username: admin - password: password - name: UUID-Pool - order: sequential - first_uuid: 0000-000000000001 - last_uuid: 0000-000000000078 - -- name: Remove UUID address pool - ucs_uuid_pool: - hostname: 172.16.143.150 - username: admin - password: password - name: UUID-Pool - state: absent -''' - -RETURN = r''' -# -''' - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.remote_management.ucs import UCSModule, ucs_argument_spec - - -def main(): - argument_spec = ucs_argument_spec - argument_spec.update( - org_dn=dict(type='str', default='org-root'), - name=dict(type='str', required=True), - description=dict(type='str', aliases=['descr'], default=''), - order=dict(type='str', default='default', choices=['default', 'sequential']), - prefix=dict(type='str', default=''), - first_uuid=dict(type='str'), - last_uuid=dict(type='str'), - state=dict(default='present', choices=['present', 'absent'], type='str'), - ) - module = AnsibleModule( - argument_spec, - supports_check_mode=True, - ) - # UCSModule verifies ucsmsdk is present and exits on failure. Imports are below ucs object creation. - ucs = UCSModule(module) - - err = False - - from ucsmsdk.mometa.uuidpool.UuidpoolPool import UuidpoolPool - from ucsmsdk.mometa.uuidpool.UuidpoolBlock import UuidpoolBlock - - ucs.result['changed'] = False - try: - mo_exists = False - props_match = False - # dn is /uuid-pool- - dn = module.params['org_dn'] + '/uuid-pool-' + module.params['name'] - mo = ucs.login_handle.query_dn(dn) - if mo: - mo_exists = True - - if module.params['state'] == 'absent': - if mo_exists: - if not module.check_mode: - ucs.login_handle.remove_mo(mo) - ucs.login_handle.commit() - ucs.result['changed'] = True - else: - if mo_exists: - # check top-level mo props - kwargs = dict(assignment_order=module.params['order']) - kwargs['descr'] = module.params['description'] - if module.params['prefix']: - kwargs['prefix'] = module.params['prefix'] - if mo.check_prop_match(**kwargs): - # top-level props match, check next level mo/props - if module.params['last_uuid'] and module.params['first_uuid']: - # uuid address block specified, check properties - block_dn = dn + '/block-from-' + module.params['first_uuid'].upper() + '-to-' + module.params['last_uuid'].upper() - mo_1 = ucs.login_handle.query_dn(block_dn) - if mo_1: - props_match = True - else: - # no UUID address block specified, but top-level props matched - props_match = True - - if not props_match: - if not module.check_mode: - # create if mo does not already exist - if not module.params['prefix']: - module.params['prefix'] = 'derived' - mo = UuidpoolPool( - parent_mo_or_dn=module.params['org_dn'], - name=module.params['name'], - descr=module.params['description'], - assignment_order=module.params['order'], - prefix=module.params['prefix'] - ) - - if module.params['last_uuid'] and module.params['first_uuid']: - mo_1 = UuidpoolBlock( - parent_mo_or_dn=mo, - to=module.params['last_uuid'], - r_from=module.params['first_uuid'], - ) - - ucs.login_handle.add_mo(mo, True) - ucs.login_handle.commit() - ucs.result['changed'] = True - - except Exception as e: - err = True - ucs.result['msg'] = "setup error: %s " % str(e) - - if err: - module.fail_json(**ucs.result) - module.exit_json(**ucs.result) - - -if __name__ == '__main__': - main() diff --git a/lib/ansible/modules/remote_management/ucs/ucs_vhba_template.py b/lib/ansible/modules/remote_management/ucs/ucs_vhba_template.py deleted file mode 100644 index 4572562d28e..00000000000 --- a/lib/ansible/modules/remote_management/ucs/ucs_vhba_template.py +++ /dev/null @@ -1,273 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'certified'} - -DOCUMENTATION = r''' ---- -module: ucs_vhba_template -short_description: Configures vHBA templates on Cisco UCS Manager -description: -- Configures vHBA templates on Cisco UCS Manager. -extends_documentation_fragment: ucs -options: - state: - description: - - If C(present), will verify vHBA templates are present and will create if needed. - - If C(absent), will verify vHBA templates are absent and will delete if needed. - choices: [present, absent] - default: present - name: - description: - - The name of the virtual HBA template. - - 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 template is created. - required: yes - description: - description: - - A user-defined description of the template. - - 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 ] - fabric: - description: - - The Fabric ID field. - - The name of the fabric interconnect that vHBAs created with this template are associated with. - choices: [A, B] - default: A - redundancy_type: - description: - - The Redundancy Type used for template pairing from the Primary or Secondary redundancy template. - - "primary — Creates configurations that can be shared with the Secondary template." - - Any other shared changes on the Primary template are automatically synchronized to the Secondary template. - - "secondary — All shared configurations are inherited from the Primary template." - - "none - Legacy vHBA template behavior. Select this option if you do not want to use redundancy." - choices: [none, primary, secondary] - default: none - vsan: - description: - - The VSAN to associate with vHBAs created from this template. - default: default - template_type: - description: - - The Template Type field. - - "This can be one of the following:" - - "initial-template — vHBAs created from this template are not updated if the template changes." - - "updating-template - vHBAs created from this template are updated if the template changes." - choices: [initial-template, updating-template] - default: initial-template - max_data: - description: - - The Max Data Field Size field. - - The maximum size of the Fibre Channel frame payload bytes that the vHBA supports. - - Enter an string between '256' and '2112'. - default: '2048' - wwpn_pool: - description: - - The WWPN pool that a vHBA created from this template uses to derive its WWPN address. - default: default - qos_policy: - description: - - The QoS policy that is associated with vHBAs created from this template. - pin_group: - description: - - The SAN pin group that is associated with vHBAs created from this template. - stats_policy: - description: - - The statistics collection policy that is associated with vHBAs created from this template. - default: default - org_dn: - description: - - Org dn (distinguished name) - default: org-root -requirements: -- ucsmsdk -author: -- David Soper (@dsoper2) -- CiscoUcs (@CiscoUcs) -version_added: '2.5' -''' - -EXAMPLES = r''' -- name: Configure vHBA template - ucs_vhba_template: - hostname: 172.16.143.150 - username: admin - password: password - name: vHBA-A - fabric: A - vsan: VSAN-A - wwpn_pool: WWPN-Pool-A - -- name: Remote vHBA template - ucs_vhba_template: - hostname: 172.16.143.150 - username: admin - password: password - name: vHBA-A - state: absent -''' - -RETURN = r''' -# -''' - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.remote_management.ucs import UCSModule, ucs_argument_spec - - -def main(): - argument_spec = ucs_argument_spec - argument_spec.update( - org_dn=dict(type='str', default='org-root'), - name=dict(type='str'), - descr=dict(type='str'), - fabric=dict(type='str', default='A', choices=['A', 'B']), - redundancy_type=dict(type='str', default='none', choices=['none', 'primary', 'secondary']), - vsan=dict(type='str', default='default'), - template_type=dict(type='str', default='initial-template', choices=['initial-template', 'updating-template']), - max_data=dict(type='str', default='2048'), - wwpn_pool=dict(type='str', default='default'), - qos_policy=dict(type='str'), - pin_group=dict(type='str'), - stats_policy=dict(type='str', default='default'), - state=dict(type='str', default='present', choices=['present', 'absent']), - vhba_template_list=dict(type='list'), - ) - - # Note that use of vhba_template_list is an experimental feature which allows multiple resource updates with a single UCSM connection. - # Support for vhba_template_list may change or be removed once persistent UCS connections are supported. - # Either vhba_template_list or name is required (user can specify either a list of single resource). - - module = AnsibleModule( - argument_spec, - supports_check_mode=True, - required_one_of=[ - ['vhba_template_list', 'name'] - ], - mutually_exclusive=[ - ['vhba_template_list', 'name'] - ], - ) - ucs = UCSModule(module) - - err = False - - from ucsmsdk.mometa.vnic.VnicSanConnTempl import VnicSanConnTempl - from ucsmsdk.mometa.vnic.VnicFcIf import VnicFcIf - - changed = False - try: - # Only documented use is a single resource, but to also support experimental - # feature allowing multiple updates all params are converted to a vhba_template_list below. - - if module.params['vhba_template_list']: - # directly use the list (single resource and list are mutually exclusive - vhba_template_list = module.params['vhba_template_list'] - else: - # single resource specified, create list from the current params - vhba_template_list = [module.params] - for vhba_template in vhba_template_list: - mo_exists = False - props_match = False - # set default params. Done here to set values for lists which can't be done in the argument_spec - if not vhba_template.get('descr'): - vhba_template['descr'] = '' - if not vhba_template.get('fabric'): - vhba_template['fabric'] = 'A' - if not vhba_template.get('redundancy_type'): - vhba_template['redundancy_type'] = 'none' - if not vhba_template.get('vsan'): - vhba_template['vsan'] = 'default' - if not vhba_template.get('template_type'): - vhba_template['template_type'] = 'initial-template' - if not vhba_template.get('max_data'): - vhba_template['max_data'] = '2048' - if not vhba_template.get('wwpn_pool'): - vhba_template['wwpn_pool'] = 'default' - if not vhba_template.get('qos_policy'): - vhba_template['qos_policy'] = '' - if not vhba_template.get('pin_group'): - vhba_template['pin_group'] = '' - if not vhba_template.get('stats_policy'): - vhba_template['stats_policy'] = 'default' - # dn is /san-conn-templ- - dn = module.params['org_dn'] + '/san-conn-templ-' + vhba_template['name'] - - mo = ucs.login_handle.query_dn(dn) - if mo: - mo_exists = True - # check top-level mo props - kwargs = dict(descr=vhba_template['descr']) - kwargs['switch_id'] = vhba_template['fabric'] - kwargs['redundancy_pair_type'] = vhba_template['redundancy_type'] - kwargs['templ_type'] = vhba_template['template_type'] - kwargs['max_data_field_size'] = vhba_template['max_data'] - kwargs['ident_pool_name'] = vhba_template['wwpn_pool'] - kwargs['qos_policy_name'] = vhba_template['qos_policy'] - kwargs['pin_to_group_name'] = vhba_template['pin_group'] - kwargs['stats_policy_name'] = vhba_template['stats_policy'] - if (mo.check_prop_match(**kwargs)): - # top-level props match, check next level mo/props - child_dn = dn + '/if-default' - mo_1 = ucs.login_handle.query_dn(child_dn) - if mo_1: - kwargs = dict(name=vhba_template['vsan']) - if (mo_1.check_prop_match(**kwargs)): - props_match = True - - if module.params['state'] == 'absent': - # mo must exist but all properties do not have to match - if mo_exists: - if not module.check_mode: - ucs.login_handle.remove_mo(mo) - ucs.login_handle.commit() - changed = True - else: - if not props_match: - if not module.check_mode: - # create if mo does not already exist - mo = VnicSanConnTempl( - parent_mo_or_dn=module.params['org_dn'], - name=vhba_template['name'], - descr=vhba_template['descr'], - switch_id=vhba_template['fabric'], - redundancy_pair_type=vhba_template['redundancy_type'], - templ_type=vhba_template['template_type'], - max_data_field_size=vhba_template['max_data'], - ident_pool_name=vhba_template['wwpn_pool'], - qos_policy_name=vhba_template['qos_policy'], - pin_to_group_name=vhba_template['pin_group'], - stats_policy_name=vhba_template['stats_policy'], - ) - - mo_1 = VnicFcIf( - parent_mo_or_dn=mo, - name=vhba_template['vsan'], - ) - - ucs.login_handle.add_mo(mo, True) - ucs.login_handle.commit() - changed = True - - except Exception as e: - err = True - ucs.result['msg'] = "setup error: %s " % str(e) - - ucs.result['changed'] = changed - if err: - module.fail_json(**ucs.result) - module.exit_json(**ucs.result) - - -if __name__ == '__main__': - main() diff --git a/lib/ansible/modules/remote_management/ucs/ucs_vlan_find.py b/lib/ansible/modules/remote_management/ucs/ucs_vlan_find.py deleted file mode 100644 index 005275ffc23..00000000000 --- a/lib/ansible/modules/remote_management/ucs/ucs_vlan_find.py +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} - -DOCUMENTATION = r''' ---- -module: ucs_vlan_find -short_description: Find VLANs on Cisco UCS Manager -description: -- Find VLANs on Cisco UCS Manager based on different criteria. -extends_documentation_fragment: ucs -options: - pattern: - description: - - Regex pattern to find within the name property of the fabricVlan class. - - This is required if C(vlanid) parameter is not supplied. - type: str - fabric: - description: - - "The fabric configuration of the VLAN. This can be one of the following:" - - "common - The VLAN applies to both fabrics and uses the same configuration parameters in both cases." - - "A — The VLAN only applies to fabric A." - - "B — The VLAN only applies to fabric B." - choices: [common, A, B] - default: common - type: str - vlanid: - description: - - The unique string identifier assigned to the VLAN. - - A VLAN ID can be between '1' and '3967', or between '4048' and '4093'. - - This is required if C(pattern) parameter is not supplied. - type: str -requirements: -- ucsmsdk -author: -- David Martinez (@dx0xm) -- CiscoUcs (@CiscoUcs) -version_added: '2.9' -''' - -EXAMPLES = r''' -- name: Get all vlans in fabric A - ucs_vlan_find: - hostname: 172.16.143.150 - username: admin - password: password - fabric: 'A' - pattern: '.' -- name: Confirm if vlan 15 is present - ucs_vlan_find: - hostname: 172.16.143.150 - username: admin - password: password - vlanid: '15' -''' - -RETURN = r''' -vlan_list: - description: basic details of vlans found - returned: on success - type: list - sample: [ - { - "id": "0", - "name": "vlcloud1" - } - ] -''' - - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.remote_management.ucs import UCSModule, ucs_argument_spec - - -def main(): - argument_spec = ucs_argument_spec - argument_spec.update( - fabric=dict(type='str', default='common', choices=['common', 'A', 'B']), - pattern=dict(type='str'), - vlanid=dict(type='str') - ) - - module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - required_one_of=[['pattern', 'vlanid']] - ) - - ucs = UCSModule(module) - - filtls = ['(cloud,"ethlan")'] - if module.params['fabric'] != 'common': - filtls.append('(switch_id,"' + module.params['fabric'] + '")') - if module.params['vlanid']: - filtls.append('(id,"' + module.params['vlanid'] + '")') - else: - filtls.append('(name,"' + module.params['pattern'] + '")') - - object_dict = ucs.login_handle.query_classid("fabricVlan", filter_str=' and '.join(filtls)) - - if object_dict is None: - module.fail_json(msg="Failed to query vlan objects") - - vlnlist = [] - for ob in object_dict: - vlnlist.append(dict(name=ob.name, id=ob.id)) - - module.exit_json(changed=False, - vlan_list=vlnlist) - - -if __name__ == '__main__': - main() diff --git a/lib/ansible/modules/remote_management/ucs/ucs_vlans.py b/lib/ansible/modules/remote_management/ucs/ucs_vlans.py deleted file mode 100644 index 4293a52d466..00000000000 --- a/lib/ansible/modules/remote_management/ucs/ucs_vlans.py +++ /dev/null @@ -1,192 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'certified'} - -DOCUMENTATION = r''' ---- -module: ucs_vlans -short_description: Configures VLANs on Cisco UCS Manager -description: -- Configures VLANs on Cisco UCS Manager. -extends_documentation_fragment: ucs -options: - state: - description: - - If C(present), will verify VLANs are present and will create if needed. - - If C(absent), will verify VLANs are absent and will delete if needed. - choices: [present, absent] - default: present - name: - description: - - The name assigned to the VLAN. - - The VLAN name is case sensitive. - - This name can be between 1 and 32 alphanumeric characters. - - "You cannot use spaces or any special characters other than - (hyphen), \"_\" (underscore), : (colon), and . (period)." - - You cannot change this name after the VLAN is created. - required: yes - multicast_policy: - description: - - The multicast policy associated with this VLAN. - - This option is only valid if the Sharing Type field is set to None or Primary. - default: '' - fabric: - description: - - "The fabric configuration of the VLAN. This can be one of the following:" - - "common - The VLAN applies to both fabrics and uses the same configuration parameters in both cases." - - "A — The VLAN only applies to fabric A." - - "B — The VLAN only applies to fabric B." - - For upstream disjoint L2 networks, Cisco recommends that you choose common to create VLANs that apply to both fabrics. - choices: [common, A, B] - default: common - id: - description: - - The unique string identifier assigned to the VLAN. - - A VLAN ID can be between '1' and '3967', or between '4048' and '4093'. - - You cannot create VLANs with IDs from 4030 to 4047. This range of VLAN IDs is reserved. - - The VLAN IDs you specify must also be supported on the switch that you are using. - - VLANs in the LAN cloud and FCoE VLANs in the SAN cloud must have different IDs. - - Optional if state is absent. - required: yes - sharing: - description: - - The Sharing Type field. - - "Whether this VLAN is subdivided into private or secondary VLANs. This can be one of the following:" - - "none - This VLAN does not have any secondary or private VLANs. This is a regular VLAN." - - "primary - This VLAN can have one or more secondary VLANs, as shown in the Secondary VLANs area. This VLAN is a primary VLAN in the private VLAN domain." - - "isolated - This is a private VLAN associated with a primary VLAN. This VLAN is an Isolated VLAN." - - "community - This VLAN can communicate with other ports on the same community VLAN as well as the promiscuous port. This VLAN is a Community VLAN." - choices: [none, primary, isolated, community] - default: none - native: - description: - - Designates the VLAN as a native VLAN. - choices: ['yes', 'no'] - default: 'no' -requirements: -- ucsmsdk -author: -- David Soper (@dsoper2) -- CiscoUcs (@CiscoUcs) -version_added: '2.5' -''' - -EXAMPLES = r''' -- name: Configure VLAN - ucs_vlans: - hostname: 172.16.143.150 - username: admin - password: password - name: vlan2 - id: '2' - native: 'yes' - -- name: Remove VLAN - ucs_vlans: - hostname: 172.16.143.150 - username: admin - password: password - name: vlan2 - state: absent -''' - -RETURN = r''' -# -''' - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.remote_management.ucs import UCSModule, ucs_argument_spec - - -def main(): - argument_spec = ucs_argument_spec - argument_spec.update( - name=dict(type='str', required=True), - multicast_policy=dict(type='str', default=''), - fabric=dict(type='str', default='common', choices=['common', 'A', 'B']), - id=dict(type='str'), - sharing=dict(type='str', default='none', choices=['none', 'primary', 'isolated', 'community']), - native=dict(type='str', default='no', choices=['yes', 'no']), - state=dict(type='str', default='present', choices=['present', 'absent']), - ) - - module = AnsibleModule( - argument_spec, - supports_check_mode=True, - required_if=[ - ['state', 'present', ['id']], - ], - ) - ucs = UCSModule(module) - - err = False - - # UCSModule creation above verifies ucsmsdk is present and exits on failure, so additional imports are done below. - from ucsmsdk.mometa.fabric.FabricVlan import FabricVlan - - changed = False - try: - mo_exists = False - props_match = False - # dn is fabric/lan/net- for common vlans or fabric/lan/[A or B]/net- for A or B - dn_base = 'fabric/lan' - if module.params['fabric'] != 'common': - dn_base += '/' + module.params['fabric'] - dn = dn_base + '/net-' + module.params['name'] - - mo = ucs.login_handle.query_dn(dn) - if mo: - mo_exists = True - - if module.params['state'] == 'absent': - # mo must exist but all properties do not have to match - if mo_exists: - if not module.check_mode: - ucs.login_handle.remove_mo(mo) - ucs.login_handle.commit() - changed = True - else: - if mo_exists: - # check top-level mo props - kwargs = dict(id=module.params['id']) - kwargs['default_net'] = module.params['native'] - kwargs['sharing'] = module.params['sharing'] - kwargs['mcast_policy_name'] = module.params['multicast_policy'] - if (mo.check_prop_match(**kwargs)): - props_match = True - - if not props_match: - if not module.check_mode: - # create if mo does not already exist - mo = FabricVlan( - parent_mo_or_dn=dn_base, - name=module.params['name'], - id=module.params['id'], - default_net=module.params['native'], - sharing=module.params['sharing'], - mcast_policy_name=module.params['multicast_policy'], - ) - - ucs.login_handle.add_mo(mo, True) - ucs.login_handle.commit() - changed = True - - except Exception as e: - err = True - ucs.result['msg'] = "setup error: %s " % str(e) - - ucs.result['changed'] = changed - if err: - module.fail_json(**ucs.result) - module.exit_json(**ucs.result) - - -if __name__ == '__main__': - main() diff --git a/lib/ansible/modules/remote_management/ucs/ucs_vnic_template.py b/lib/ansible/modules/remote_management/ucs/ucs_vnic_template.py deleted file mode 100644 index 18f7f613265..00000000000 --- a/lib/ansible/modules/remote_management/ucs/ucs_vnic_template.py +++ /dev/null @@ -1,376 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'certified'} - -DOCUMENTATION = r''' ---- -module: ucs_vnic_template -short_description: Configures vNIC templates on Cisco UCS Manager -description: -- Configures vNIC templates on Cisco UCS Manager. -extends_documentation_fragment: ucs -options: - state: - description: - - If C(present), will verify vNIC templates are present and will create if needed. - - If C(absent), will verify vNIC templates are absent and will delete if needed. - choices: [present, absent] - default: present - name: - description: - - The name of the vNIC template. - - 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 template is created. - required: yes - description: - description: - - A user-defined description of the vNIC template. - - 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 ] - fabric: - description: - - The Fabric ID field specifying the fabric interconnect associated with vNICs created from this template. - - If you want fabric failover enabled on vNICs created from this template, use of of the following:" - - "A-B to use Fabric A by default with failover enabled." - - "B-A to use Fabric B by default with failover enabled." - - "Do not enable vNIC fabric failover under the following circumstances:" - - "- If the Cisco UCS domain is running in Ethernet switch mode. vNIC fabric failover is not supported in that mode." - - "- If you plan to associate one or more vNICs created from this template to a server with an adapter that does not support fabric failover." - choices: [A, B, A-B, B-A] - default: A - redundancy_type: - description: - - The Redundancy Type used for vNIC redundancy pairs during fabric failover. - - "This can be one of the following:" - - "primary — Creates configurations that can be shared with the Secondary template." - - "secondary — All shared configurations are inherited from the Primary template." - - "none - Legacy vNIC template behavior. Select this option if you do not want to use redundancy." - choices: [none, primary, secondary] - default: none - peer_redundancy_template: - description: - - The Peer Redundancy Template. - - The name of the vNIC template sharing a configuration with this template. - - If the redundancy_type is primary, the name of the secondary template should be provided. - - If the redundancy_type is secondary, the name of the primary template should be provided. - - Secondary templates can only configure non-shared properties (name, description, and mac_pool). - aliases: [ peer_redundancy_templ ] - target: - description: - - The possible target for vNICs created from this template. - - The target determines whether or not Cisco UCS Manager automatically creates a VM-FEX port profile with the appropriate settings for the vNIC template. - - "This can be one of the following:" - - "adapter — The vNICs apply to all adapters. No VM-FEX port profile is created if you choose this option." - - "vm - The vNICs apply to all virtual machines. A VM-FEX port profile is created if you choose this option." - default: adapter - template_type: - description: - - The Template Type field. - - "This can be one of the following:" - - "initial-template — vNICs created from this template are not updated if the template changes." - - "updating-template - vNICs created from this template are updated if the template changes." - choices: [initial-template, updating-template] - default: initial-template - vlans_list: - description: - - List of VLANs used by the vNIC template. - - "Each list element has the following suboptions:" - - "= name" - - " The name of the VLAN (required)." - - "- native" - - " Designates the VLAN as a native VLAN. Only one VLAN in the list can be a native VLAN." - - " [choices: 'no', 'yes']" - - " [Default: 'no']" - - "- state" - - " If present, will verify VLAN is present on template." - - " If absent, will verify VLAN is absent on template." - - " choices: [present, absent]" - - " default: present" - cdn_source: - description: - - CDN Source field. - - "This can be one of the following options:" - - "vnic-name - Uses the vNIC template name of the vNIC instance as the CDN name. This is the default option." - - "user-defined - Uses a user-defined CDN name for the vNIC template. If this option is chosen, cdn_name must also be provided." - choices: [vnic-name, user-defined] - default: vnic-name - cdn_name: - description: - - CDN Name used when cdn_source is set to user-defined. - mtu: - description: - - The MTU field. - - The maximum transmission unit, or packet size, that vNICs created from this vNIC template should use. - - Enter a string between '1500' and '9000'. - - If the vNIC template has an associated QoS policy, the MTU specified here must be equal to or less than the MTU specified in the QoS system class. - default: '1500' - mac_pool: - description: - - The MAC address pool that vNICs created from this vNIC template should use. - qos_policy: - description: - - The quality of service (QoS) policy that vNICs created from this vNIC template should use. - network_control_policy: - description: - - The network control policy that vNICs created from this vNIC template should use. - pin_group: - description: - - The LAN pin group that vNICs created from this vNIC template should use. - stats_policy: - description: - - The statistics collection policy that vNICs created from this vNIC template should use. - default: default - org_dn: - description: - - Org dn (distinguished name) - default: org-root -requirements: -- ucsmsdk -author: -- David Soper (@dsoper2) -- CiscoUcs (@CiscoUcs) -version_added: '2.5' -''' - -EXAMPLES = r''' -- name: Configure vNIC template - ucs_vnic_template: - hostname: 172.16.143.150 - username: admin - password: password - name: vNIC-A - fabric: A - vlans_list: - - name: default - native: 'yes' - -- name: Configure vNIC template with failover - ucs_vnic_template: - hostname: 172.16.143.150 - username: admin - password: password - name: vNIC-A-B - fabric: A-B - vlans_list: - - name: default - native: 'yes' - state: present - -- name: Remove vNIC template - ucs_vnic_template: - hostname: 172.16.143.150 - username: admin - password: password - name: vNIC-A - state: absent - -- name: Remove another vNIC template - ucs_vnic_template: - hostname: 172.16.143.150 - username: admin - password: password - name: vNIC-A-B - state: absent - -- name: Remove VLAN from template - ucs_vnic_template: - hostname: 172.16.143.150 - username: admin - password: password - name: vNIC-A-B - fabric: A-B - vlans_list: - - name: default - native: 'yes' - state: absent -''' - -RETURN = r''' -# -''' - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.remote_management.ucs import UCSModule, ucs_argument_spec - - -def main(): - argument_spec = ucs_argument_spec - argument_spec.update( - org_dn=dict(type='str', default='org-root'), - name=dict(type='str', required=True), - description=dict(type='str', aliases=['descr'], default=''), - fabric=dict(type='str', default='A', choices=['A', 'B', 'A-B', 'B-A']), - redundancy_type=dict(type='str', default='none', choices=['none', 'primary', 'secondary']), - peer_redundancy_template=dict(type='str', aliases=['peer_redundancy_templ'], default=''), - target=dict(type='str', default='adapter', choices=['adapter', 'vm']), - template_type=dict(type='str', default='initial-template', choices=['initial-template', 'updating-template']), - vlans_list=dict(type='list'), - cdn_source=dict(type='str', default='vnic-name', choices=['vnic-name', 'user-defined']), - cdn_name=dict(type='str', default=''), - mtu=dict(type='str', default='1500'), - mac_pool=dict(type='str', default=''), - qos_policy=dict(type='str', default=''), - network_control_policy=dict(type='str', default=''), - pin_group=dict(type='str', default=''), - stats_policy=dict(type='str', default='default'), - state=dict(type='str', default='present', choices=['present', 'absent']), - ) - - module = AnsibleModule( - argument_spec, - supports_check_mode=True, - required_if=[ - ['cdn_source', 'user-defined', ['cdn_name']], - ], - ) - ucs = UCSModule(module) - - err = False - - # UCSModule creation above verifies ucsmsdk is present and exits on failure. Additional imports are done below. - from ucsmsdk.mometa.vnic.VnicLanConnTempl import VnicLanConnTempl - from ucsmsdk.mometa.vnic.VnicEtherIf import VnicEtherIf - - changed = False - try: - mo_exists = False - props_match = False - # dn is /lan-conn-templ- - dn = module.params['org_dn'] + '/lan-conn-templ-' + module.params['name'] - - mo = ucs.login_handle.query_dn(dn) - if mo: - mo_exists = True - - if module.params['state'] == 'absent': - # mo must exist but all properties do not have to match - if mo_exists: - if not module.check_mode: - ucs.login_handle.remove_mo(mo) - ucs.login_handle.commit() - changed = True - else: - # set default params for lists which can't be done in the argument_spec - if module.params.get('vlans_list'): - for vlan in module.params['vlans_list']: - if not vlan.get('native'): - vlan['native'] = 'no' - if not vlan.get('state'): - vlan['state'] = 'present' - # for target 'adapter', change to internal UCS Manager spelling 'adaptor' - if module.params['target'] == 'adapter': - module.params['target'] = 'adaptor' - if mo_exists: - # check top-level mo props - kwargs = dict(descr=module.params['description']) - kwargs['switch_id'] = module.params['fabric'] - kwargs['redundancy_pair_type'] = module.params['redundancy_type'] - kwargs['peer_redundancy_templ_name'] = module.params['peer_redundancy_template'] - kwargs['ident_pool_name'] = module.params['mac_pool'] - # do not check shared props if this is a secondary template - if module.params['redundancy_type'] != 'secondary': - kwargs['target'] = module.params['target'] - kwargs['templ_type'] = module.params['template_type'] - kwargs['cdn_source'] = module.params['cdn_source'] - kwargs['admin_cdn_name'] = module.params['cdn_name'] - kwargs['mtu'] = module.params['mtu'] - kwargs['qos_policy_name'] = module.params['qos_policy'] - kwargs['nw_ctrl_policy_name'] = module.params['network_control_policy'] - kwargs['pin_to_group_name'] = module.params['pin_group'] - kwargs['stats_policy_name'] = module.params['stats_policy'] - if mo.check_prop_match(**kwargs): - # top-level props match, check next level mo/props - if not module.params.get('vlans_list'): - props_match = True - else: - # check vlan props - for vlan in module.params['vlans_list']: - child_dn = dn + '/if-' + str(vlan['name']) - mo_1 = ucs.login_handle.query_dn(child_dn) - if vlan['state'] == 'absent': - if mo_1: - props_match = False - break - else: - if mo_1: - kwargs = dict(default_net=vlan['native']) - if mo_1.check_prop_match(**kwargs): - props_match = True - else: - props_match = False - break - - if not props_match: - if not module.check_mode: - # create if mo does not already exist - # secondary template only sets non shared props - if module.params['redundancy_type'] == 'secondary': - mo = VnicLanConnTempl( - parent_mo_or_dn=module.params['org_dn'], - name=module.params['name'], - descr=module.params['description'], - switch_id=module.params['fabric'], - redundancy_pair_type=module.params['redundancy_type'], - peer_redundancy_templ_name=module.params['peer_redundancy_template'], - ident_pool_name=module.params['mac_pool'], - ) - else: - mo = VnicLanConnTempl( - parent_mo_or_dn=module.params['org_dn'], - name=module.params['name'], - descr=module.params['description'], - switch_id=module.params['fabric'], - redundancy_pair_type=module.params['redundancy_type'], - peer_redundancy_templ_name=module.params['peer_redundancy_template'], - target=module.params['target'], - templ_type=module.params['template_type'], - cdn_source=module.params['cdn_source'], - admin_cdn_name=module.params['cdn_name'], - mtu=module.params['mtu'], - ident_pool_name=module.params['mac_pool'], - qos_policy_name=module.params['qos_policy'], - nw_ctrl_policy_name=module.params['network_control_policy'], - pin_to_group_name=module.params['pin_group'], - stats_policy_name=module.params['stats_policy'], - ) - - if module.params.get('vlans_list'): - for vlan in module.params['vlans_list']: - if vlan['state'] == 'absent': - child_dn = dn + '/if-' + str(vlan['name']) - mo_1 = ucs.login_handle.query_dn(child_dn) - ucs.login_handle.remove_mo(mo_1) - else: - mo_1 = VnicEtherIf( - parent_mo_or_dn=mo, - name=str(vlan['name']), - default_net=vlan['native'], - ) - - ucs.login_handle.add_mo(mo, True) - ucs.login_handle.commit() - changed = True - - except Exception as e: - err = True - ucs.result['msg'] = "setup error: %s " % str(e) - - ucs.result['changed'] = changed - if err: - module.fail_json(**ucs.result) - module.exit_json(**ucs.result) - - -if __name__ == '__main__': - main() diff --git a/lib/ansible/modules/remote_management/ucs/ucs_vsans.py b/lib/ansible/modules/remote_management/ucs/ucs_vsans.py deleted file mode 100644 index 35b42b5033c..00000000000 --- a/lib/ansible/modules/remote_management/ucs/ucs_vsans.py +++ /dev/null @@ -1,201 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'certified'} - -DOCUMENTATION = r''' ---- -module: ucs_vsans -short_description: Configures VSANs on Cisco UCS Manager -description: -- Configures VSANs on Cisco UCS Manager. -extends_documentation_fragment: ucs -options: - state: - description: - - If C(present), will verify VSANs are present and will create if needed. - - If C(absent), will verify VSANs are absent and will delete if needed. - choices: [present, absent] - default: present - name: - description: - - The name assigned to the VSAN. - - This name can be between 1 and 32 alphanumeric characters. - - "You cannot use spaces or any special characters other than - (hyphen), \"_\" (underscore), : (colon), and . (period)." - - You cannot change this name after the VSAN is created. - required: yes - vsan_id: - description: - - The unique identifier assigned to the VSAN. - - The ID can be a string between '1' and '4078', or between '4080' and '4093'. '4079' is a reserved VSAN ID. - - In addition, if you plan to use FC end-host mode, the range between '3840' to '4079' is also a reserved VSAN ID range. - - Optional if state is absent. - required: yes - vlan_id: - description: - - The unique string identifier assigned to the VLAN used for Fibre Channel connections. - - Note that Cisco UCS Manager uses VLAN '4048'. See the UCS Manager configuration guide if you want to assign '4048' to a VLAN. - - Optional if state is absent. - required: yes - fc_zoning: - description: - - Fibre Channel zoning configuration for the Cisco UCS domain. - - "Fibre Channel zoning can be set to one of the following values:" - - "disabled — The upstream switch handles Fibre Channel zoning, or Fibre Channel zoning is not implemented for the Cisco UCS domain." - - "enabled — Cisco UCS Manager configures and controls Fibre Channel zoning for the Cisco UCS domain." - - If you enable Fibre Channel zoning, do not configure the upstream switch with any VSANs that are being used for Fibre Channel zoning. - choices: [disabled, enabled] - default: disabled - fabric: - description: - - "The fabric configuration of the VSAN. This can be one of the following:" - - "common - The VSAN maps to the same VSAN ID in all available fabrics." - - "A - The VSAN maps to the a VSAN ID that exists only in fabric A." - - "B - The VSAN maps to the a VSAN ID that exists only in fabric B." - choices: [common, A, B] - default: common -requirements: -- ucsmsdk -author: -- David Soper (@dsoper2) -- CiscoUcs (@CiscoUcs) -version_added: '2.5' -''' - -EXAMPLES = r''' -- name: Configure VSAN - ucs_vsans: - hostname: 172.16.143.150 - username: admin - password: password - name: vsan110 - vsan_id: '110' - vlan_id: '110' - -- name: Remove VSAN - ucs_vsans: - hostname: 172.16.143.150 - username: admin - password: password - name: vsan110 -''' - -RETURN = r''' -# -''' - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.remote_management.ucs import UCSModule, ucs_argument_spec - - -def main(): - argument_spec = ucs_argument_spec - argument_spec.update( - name=dict(type='str'), - vsan_id=dict(type='str'), - vlan_id=dict(type='str'), - fc_zoning=dict(type='str', default='disabled', choices=['disabled', 'enabled']), - fabric=dict(type='str', default='common', choices=['common', 'A', 'B']), - state=dict(type='str', default='present', choices=['present', 'absent']), - vsan_list=dict(type='list'), - ) - - # Note that use of vsan_list is an experimental feature which allows multiple resource updates with a single UCSM connection. - # Support for vsan_list may change or be removed once persistent UCS connections are supported. - # Either vsan_list or name/vsan_id/vlan_id is required (user can specify either a list or single resource). - - module = AnsibleModule( - argument_spec, - supports_check_mode=True, - required_one_of=[ - ['vsan_list', 'name'] - ], - mutually_exclusive=[ - ['vsan_list', 'name'] - ], - ) - ucs = UCSModule(module) - - err = False - - from ucsmsdk.mometa.fabric.FabricVsan import FabricVsan - - changed = False - try: - # Only documented use is a single resource, but to also support experimental - # feature allowing multiple updates all params are converted to a vsan_list below. - - if module.params['vsan_list']: - # directly use the list (single resource and list are mutually exclusive - vsan_list = module.params['vsan_list'] - else: - # single resource specified, create list from the current params - vsan_list = [module.params] - for vsan in vsan_list: - mo_exists = False - props_match = False - # set default params. Done here to set values for lists which can't be done in the argument_spec - if not vsan.get('fc_zoning'): - vsan['fc_zoning'] = 'disabled' - if not vsan.get('fabric'): - vsan['fabric'] = 'common' - # dn is fabric/san/net- for common vsans or fabric/san/[A or B]/net- for A or B - dn_base = 'fabric/san' - if vsan['fabric'] != 'common': - dn_base += '/' + vsan['fabric'] - dn = dn_base + '/net-' + vsan['name'] - - mo = ucs.login_handle.query_dn(dn) - if mo: - mo_exists = True - - if module.params['state'] == 'absent': - # mo must exist but all properties do not have to match - if mo_exists: - if not module.check_mode: - ucs.login_handle.remove_mo(mo) - ucs.login_handle.commit() - changed = True - else: - if mo_exists: - # check top-level mo props - kwargs = dict(id=vsan['vsan_id']) - kwargs['fcoe_vlan'] = vsan['vlan_id'] - kwargs['zoning_state'] = vsan['fc_zoning'] - if (mo.check_prop_match(**kwargs)): - props_match = True - - if not props_match: - if not module.check_mode: - # create if mo does not already exist - mo = FabricVsan( - parent_mo_or_dn=dn_base, - name=vsan['name'], - id=vsan['vsan_id'], - fcoe_vlan=vsan['vlan_id'], - zoning_state=vsan['fc_zoning'], - ) - - ucs.login_handle.add_mo(mo, True) - ucs.login_handle.commit() - changed = True - - except Exception as e: - err = True - ucs.result['msg'] = "setup error: %s " % str(e) - - ucs.result['changed'] = changed - if err: - module.fail_json(**ucs.result) - module.exit_json(**ucs.result) - - -if __name__ == '__main__': - main() diff --git a/lib/ansible/modules/remote_management/ucs/ucs_wwn_pool.py b/lib/ansible/modules/remote_management/ucs/ucs_wwn_pool.py deleted file mode 100644 index fc77c9c8915..00000000000 --- a/lib/ansible/modules/remote_management/ucs/ucs_wwn_pool.py +++ /dev/null @@ -1,238 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'certified'} - -DOCUMENTATION = r''' ---- -module: ucs_wwn_pool -short_description: Configures WWNN or WWPN pools on Cisco UCS Manager -description: -- Configures WWNNs or WWPN pools on Cisco UCS Manager. -extends_documentation_fragment: ucs -options: - state: - description: - - If C(present), will verify WWNNs/WWPNs are present and will create if needed. - - If C(absent), will verify WWNNs/WWPNs are absent and will delete if needed. - choices: [present, absent] - default: present - name: - description: - - The name of the World Wide Node Name (WWNN) or World Wide Port Name (WWPN) pool. - - This name can be between 1 and 32 alphanumeric characters. - - "You cannot use spaces or any special characters other than - (hyphen), \"_\" (underscore), : (colon), and . (period)." - - You cannot change this name after the WWNN or WWPN pool is created. - required: yes - purpose: - description: - - Specify whether this is a node (WWNN) or port (WWPN) pool. - - Optional if state is absent. - choices: [node, port] - required: yes - description: - description: - - A description of the WWNN or WWPN pool. - - 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 ] - order: - description: - - The Assignment Order field. - - "This can be one of the following:" - - "default - Cisco UCS Manager selects a random identity from the pool." - - "sequential - Cisco UCS Manager selects the lowest available identity from the pool." - choices: [default, sequential] - default: default - first_addr: - description: - - The first initiator in the World Wide Name (WWN) block. - - This is the From field in the UCS Manager Add WWN Blocks menu. - last_addr: - description: - - The last initiator in the World Wide Name (WWN) block. - - This is the To field in the UCS Manager Add WWN Blocks menu. - - For WWxN pools, the pool size must be a multiple of ports-per-node + 1. - - For example, if there are 7 ports per node, the pool size must be a multiple of 8. - - If there are 63 ports per node, the pool size must be a multiple of 64. - org_dn: - description: - - Org dn (distinguished name) - default: org-root -requirements: -- ucsmsdk -author: -- David Soper (@dsoper2) -- CiscoUcs (@CiscoUcs) -version_added: '2.5' -''' - -EXAMPLES = r''' -- name: Configure WWNN/WWPN pools - ucs_wwn_pool: - hostname: 172.16.143.150 - username: admin - password: password - name: WWNN-Pool - purpose: node - first_addr: 20:00:00:25:B5:48:00:00 - last_addr: 20:00:00:25:B5:48:00:0F -- ucs_wwn_pool: - hostname: 172.16.143.150 - username: admin - password: password - name: WWPN-Pool-A - purpose: port - order: sequential - first_addr: 20:00:00:25:B5:48:0A:00 - last_addr: 20:00:00:25:B5:48:0A:0F - -- name: Remove WWNN/WWPN pools - ucs_wwn_pool: - hostname: 172.16.143.150 - username: admin - password: password - name: WWNN-Pool - state: absent -- ucs_wwn_pool: - hostname: 172.16.143.150 - username: admin - password: password - name: WWPN-Pool-A - state: absent -''' - -RETURN = r''' -# -''' - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.remote_management.ucs import UCSModule, ucs_argument_spec - - -def main(): - argument_spec = ucs_argument_spec - argument_spec.update( - org_dn=dict(type='str', default='org-root'), - name=dict(type='str'), - purpose=dict(type='str', choices=['node', 'port']), - descr=dict(type='str'), - order=dict(type='str', default='default', choices=['default', 'sequential']), - first_addr=dict(type='str'), - last_addr=dict(type='str'), - state=dict(type='str', default='present', choices=['present', 'absent']), - wwn_list=dict(type='list'), - ) - - # Note that use of wwn_list is an experimental feature which allows multiple resource updates with a single UCSM connection. - # Support for wwn_list may change or be removed once persistent UCS connections are supported. - # Either wwn_list or name is required (user can specify either a list or single resource). - - module = AnsibleModule( - argument_spec, - supports_check_mode=True, - required_one_of=[ - ['wwn_list', 'name'] - ], - mutually_exclusive=[ - ['wwn_list', 'name'] - ], - ) - ucs = UCSModule(module) - - err = False - - from ucsmsdk.mometa.fcpool.FcpoolInitiators import FcpoolInitiators - from ucsmsdk.mometa.fcpool.FcpoolBlock import FcpoolBlock - - changed = False - try: - # Only documented use is a single resource, but to also support experimental - # feature allowing multiple updates all params are converted to a wwn_list below. - - if module.params['wwn_list']: - # directly use the list (single resource and list are mutually exclusive - wwn_list = module.params['wwn_list'] - else: - # single resource specified, create list from the current params - wwn_list = [module.params] - for wwn in wwn_list: - mo_exists = False - props_match = False - # set default params. Done here to set values for lists which can't be done in the argument_spec - if not wwn.get('descr'): - wwn['descr'] = '' - if not wwn.get('order'): - wwn['order'] = 'default' - # dn is /wwn-pool- for WWNN or WWPN - dn = module.params['org_dn'] + '/wwn-pool-' + wwn['name'] - - mo = ucs.login_handle.query_dn(dn) - if mo: - mo_exists = True - - if module.params['state'] == 'absent': - if mo_exists: - if not module.check_mode: - ucs.login_handle.remove_mo(mo) - ucs.login_handle.commit() - changed = True - else: - # append purpose param with suffix used by UCSM - purpose_param = wwn['purpose'] + '-wwn-assignment' - if mo_exists: - # check top-level mo props - kwargs = dict(assignment_order=wwn['order']) - kwargs['descr'] = wwn['descr'] - kwargs['purpose'] = purpose_param - if (mo.check_prop_match(**kwargs)): - # top-level props match, check next level mo/props - if 'last_addr' in wwn and 'first_addr' in wwn: - block_dn = dn + '/block-' + wwn['first_addr'].upper() + '-' + wwn['last_addr'].upper() - mo_1 = ucs.login_handle.query_dn(block_dn) - if mo_1: - props_match = True - else: - props_match = True - - if not props_match: - if not module.check_mode: - # create if mo does not already exist - mo = FcpoolInitiators( - parent_mo_or_dn=module.params['org_dn'], - name=wwn['name'], - descr=wwn['descr'], - assignment_order=wwn['order'], - purpose=purpose_param, - ) - if 'last_addr' in wwn and 'first_addr' in wwn: - mo_1 = FcpoolBlock( - parent_mo_or_dn=mo, - to=wwn['last_addr'], - r_from=wwn['first_addr'], - ) - - ucs.login_handle.add_mo(mo, True) - ucs.login_handle.commit() - changed = True - - except Exception as e: - err = True - ucs.result['msg'] = "setup error: %s " % str(e) - - ucs.result['changed'] = changed - if err: - module.fail_json(**ucs.result) - module.exit_json(**ucs.result) - - -if __name__ == '__main__': - main() diff --git a/lib/ansible/plugins/doc_fragments/ucs.py b/lib/ansible/plugins/doc_fragments/ucs.py deleted file mode 100644 index 5c2c08add96..00000000000 --- a/lib/ansible/plugins/doc_fragments/ucs.py +++ /dev/null @@ -1,73 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Ansible, but is an independent component. -# This particular file snippet, and this file snippet only, is BSD licensed. -# Modules you write using this snippet, which is embedded dynamically by Ansible -# still belong to the author of the module, and may assign their own license -# to the complete work. -# -# (c) 2016 Red Hat Inc. -# (c) 2020 Cisco Systems Inc. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - - -class ModuleDocFragment(object): - # Cisco UCS doc fragment - DOCUMENTATION = ''' -notes: - - Examples can be used with the L(UCS Platform Emulator, https://cs.co/ucspe). -options: - hostname: - description: - - IP address or hostname of Cisco UCS Manager. - type: str - required: yes - username: - description: - - Username for Cisco UCS Manager authentication. - type: str - default: admin - password: - description: - - Password for Cisco UCS Manager authentication. - type: str - required: yes - port: - description: - - Port number to be used during connection (by default uses 443 for https and 80 for http connection). - type: int - use_ssl: - description: - - If C(no), an HTTP connection will be used instead of the default HTTPS connection. - type: bool - default: yes - use_proxy: - description: - - If C(no), will not use the proxy as defined by system environment variable. - type: bool - default: yes - proxy: - description: - - If use_proxy is no, specfies proxy to be used for connection. - e.g. 'http://proxy.xy.z:8080' - type: str -''' diff --git a/test/integration/targets/ucs_disk_group_policy/aliases b/test/integration/targets/ucs_disk_group_policy/aliases deleted file mode 100644 index 0689fba3e4a..00000000000 --- a/test/integration/targets/ucs_disk_group_policy/aliases +++ /dev/null @@ -1,7 +0,0 @@ -# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware. -# Example integration_config.yml: -# --- -# ucs_hostname: 172.16.143.136 -# ucs_username: admin -# ucs_password: password -unsupported diff --git a/test/integration/targets/ucs_disk_group_policy/tasks/main.yml b/test/integration/targets/ucs_disk_group_policy/tasks/main.yml deleted file mode 100644 index 717f609674a..00000000000 --- a/test/integration/targets/ucs_disk_group_policy/tasks/main.yml +++ /dev/null @@ -1,193 +0,0 @@ -# Test code for the UCS modules -# Copyright 2018, David Soper (@dsoper2) - -- name: Test that we have a UCS host, UCS username, and UCS password - fail: - msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' - when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined - vars: - login_info: &login_info - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - -# Setup (clean environment) -- name: Disk Group Policy absent - ucs_disk_group_policy: &disk_group_policy_absent - <<: *login_info - name: DEE-DG - state: absent - - -# Test present (check_mode) -- name: Disk Group Policy present (check_mode) - ucs_disk_group_policy: &disk_group_policy_present - <<: *login_info - name: DEE-DG - raid_level: mirror - configuration_mode: manual - manual_disks: - - slot_num: '1' - role: normal - - slot_num: '2' - role: normal - check_mode: yes - register: cm_disk_group_policy_present - - -# Present (normal mode) -- name: Disk Group Policy present (normal mode) - ucs_disk_group_policy: *disk_group_policy_present - register: nm_disk_group_policy_present - - -# Test present again (idempotent) -- name: Disk Group Policy present again (check_mode) - ucs_disk_group_policy: *disk_group_policy_present - check_mode: yes - register: cm_disk_group_policy_present_again - - -# Present again (normal mode) -- name: Disk Group Policy present again (normal mode) - ucs_disk_group_policy: *disk_group_policy_present - register: nm_disk_group_policy_present_again - - -# Verfiy present -- name: Verify Disk Group Policy present results - assert: - that: - - cm_disk_group_policy_present.changed == nm_disk_group_policy_present.changed == true - - cm_disk_group_policy_present_again.changed == nm_disk_group_policy_present_again.changed == false - - -# Test change (check_mode) -- name: Disk Group Policy change (check_mode) - ucs_disk_group_policy: &disk_group_policy_change - <<: *login_info - 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 - check_mode: yes - register: cm_disk_group_policy_change - - -# Change (normal mode) -- name: Disk Group Policy change (normal mode) - ucs_disk_group_policy: *disk_group_policy_change - register: nm_disk_group_policy_change - - -# Test change again (idempotent) -- name: Disk Group Policy again (check_mode) - ucs_disk_group_policy: *disk_group_policy_change - check_mode: yes - register: cm_disk_group_policy_change_again - - -# Change again (normal mode) -- name: Disk Group Policy change again (normal mode) - ucs_disk_group_policy: *disk_group_policy_change - register: nm_disk_group_policy_change_again - - -# Verfiy change -- name: Verify Disk Group Policy change results - assert: - that: - - cm_disk_group_policy_change.changed == nm_disk_group_policy_change.changed == true - - cm_disk_group_policy_change_again.changed == nm_disk_group_policy_change_again.changed == false - - -# Clean environment for next tests -- name: Disk Group Policy absent for automatic testing - ucs_disk_group_policy: &disk_group_policy_absent_auto - <<: *login_info - name: DEE-DG - state: absent - - -# Test automatic configuration mode (check_mode) -- name: Disk Group Policy automatic (check_mode) - ucs_disk_group_policy: &disk_group_policy_auto - <<: *login_info - name: DEE-DG - raid_level: mirror - configuration_mode: automatic - drive_type: SSD - num_drives: 2 - virtual_drive: - access_policy: platform-default - io_policy: direct - strip_size: 64KB - check_mode: yes - register: cm_disk_group_policy_auto - - -# Automatic configuration (normal mode) -- name: Disk Group Policy automatic (normal mode) - ucs_disk_group_policy: *disk_group_policy_auto - register: nm_disk_group_policy_auto - - -# Test automatic configuration again (idempotent) -- name: Disk Group Policy automatic again (check_mode) - ucs_disk_group_policy: *disk_group_policy_auto - check_mode: yes - register: cm_disk_group_policy_auto_again - - -# Automatic configuration again (normal mode) -- name: Disk Group Policy automatic again (normal mode) - ucs_disk_group_policy: *disk_group_policy_auto - register: nm_disk_group_policy_auto_again - - -# Verfiy Automatic configuration -- name: Verify Disk Group Policy automatic results - assert: - that: - - cm_disk_group_policy_auto.changed == nm_disk_group_policy_auto.changed == true - - cm_disk_group_policy_auto_again.changed == nm_disk_group_policy_auto_again.changed == false - - -# Teardown (clean environment) -- name: Disk Group Policy absent (check_mode) - ucs_disk_group_policy: *disk_group_policy_absent - check_mode: yes - register: cm_disk_group_policy_absent - - -# Absent (normal mode) -- name: Disk Group Policy absent (normal mode) - ucs_disk_group_policy: *disk_group_policy_absent - register: nm_disk_group_policy_absent - - -# Test absent again (idempotent) -- name: Disk Group Policy absent again (check_mode) - ucs_disk_group_policy: *disk_group_policy_absent - check_mode: yes - register: cm_disk_group_policy_absent_again - - -# Absent again (normal mode) -- name: Disk Group Policy absent again (normal mode) - ucs_disk_group_policy: *disk_group_policy_absent - register: nm_disk_group_policy_absent_again - - -# Verfiy absent -- name: Verify Disk Group Policy absent results - assert: - that: - - cm_disk_group_policy_absent.changed == nm_disk_group_policy_absent.changed == true - - cm_disk_group_policy_absent_again.changed == nm_disk_group_policy_absent_again.changed == false diff --git a/test/integration/targets/ucs_dns_server/aliases b/test/integration/targets/ucs_dns_server/aliases deleted file mode 100644 index 39a783a0837..00000000000 --- a/test/integration/targets/ucs_dns_server/aliases +++ /dev/null @@ -1,7 +0,0 @@ -# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware. -# Example integration_config.yml: -# --- -# ucs_hostname: 10.10.10.10 -# ucs_username: admin -# ucs_password: password -unsupported \ No newline at end of file diff --git a/test/integration/targets/ucs_dns_server/tasks/main.yml b/test/integration/targets/ucs_dns_server/tasks/main.yml deleted file mode 100644 index 9050d82d474..00000000000 --- a/test/integration/targets/ucs_dns_server/tasks/main.yml +++ /dev/null @@ -1,110 +0,0 @@ -# Test code for the UCS modules -# Copyright 2018, John McDonough (@movinalot) - -- name: Test that we have a UCS host, UCS username, and UCS password. - fail: - msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' - when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined - vars: - login_info: &login_info - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - -# Setup (clean environment) -- name: DNS Server absent - ucs_dns_server: &dns_server_absent - <<: *login_info - dns_server: 10.10.10.10 - state: absent - -# Test present (check_mode) -- name: DNS Server present (check_mode) - ucs_dns_server: &dns_server_present - <<: *login_info - dns_server: 10.10.10.10 - check_mode: yes - register: cm_dns_server_present - -# Present (normal mode) -- name: DNS Server present (normal mode) - ucs_dns_server: *dns_server_present - register: nm_dns_server_present - -# Test present again (idempotent) -- name: DNS Server present again (check_mode) - ucs_dns_server: *dns_server_present - check_mode: yes - register: cm_dns_server_present_again - -# Present again (normal mode) -- name: DNS Server present again (normal mode) - ucs_dns_server: *dns_server_present - register: nm_dns_server_present_again - -# Verfiy present -- name: Verify DNS Server present results - assert: - that: - - cm_dns_server_present.changed == nm_dns_server_present.changed == true - - cm_dns_server_present_again.changed == nm_dns_server_present_again.changed == false - -# Test change (check_mode) -- name: DNS DNS Server change (check_mode) - ucs_dns_server: &dns_server_change - <<: *dns_server_present - dns_server: 10.10.10.10 - check_mode: yes - register: cm_dns_dns_server_change - -# Change (normal mode) -- name: DNS DNS Server change (normal mode) - ucs_dns_server: *dns_server_change - register: nm_dns_dns_server_change - -# Test change again (idempotent) -- name: DNS DNS Server change again (check_mode) - ucs_dns_server: *dns_server_change - check_mode: yes - register: cm_dns_dns_server_change_again - -# Change again (normal mode) -- name: DNS DNS Server change again (normal mode) - ucs_dns_server: *dns_server_change - register: nm_dns_dns_server_change_again - -# Verfiy change -- name: Verify DNS DNS Server change results - assert: - that: - - cm_dns_dns_server_change.changed == nm_dns_dns_server_change.changed == true - - cm_dns_dns_server_change_again.changed == nm_dns_dns_server_change_again.changed == false - -# Teardown (clean environment) -- name: DNS Server absent (check_mode) - ucs_dns_server: *dns_server_absent - check_mode: yes - register: cm_dns_server_absent - -# Absent (normal mode) -- name: DNS Server absent (normal mode) - ucs_dns_server: *dns_server_absent - register: nm_dns_server_absent - -# Test absent again (idempotent) -- name: DNS Server absent again (check_mode) - ucs_dns_server: *dns_server_absent - check_mode: yes - register: cm_dns_server_absent_again - -# Absent again (normal mode) -- name: DNS Server absent again (normal mode) - ucs_dns_server: *dns_server_absent - register: nm_dns_server_absent_again - -# Verfiy absent -- name: Verify DNS Server absent results - assert: - that: - - cm_dns_server_absent.changed == nm_dns_server_absent.changed == true - - cm_dns_server_absent_again.changed == nm_dns_server_absent_again.changed == false diff --git a/test/integration/targets/ucs_ip_pool/aliases b/test/integration/targets/ucs_ip_pool/aliases deleted file mode 100644 index 0689fba3e4a..00000000000 --- a/test/integration/targets/ucs_ip_pool/aliases +++ /dev/null @@ -1,7 +0,0 @@ -# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware. -# Example integration_config.yml: -# --- -# ucs_hostname: 172.16.143.136 -# ucs_username: admin -# ucs_password: password -unsupported diff --git a/test/integration/targets/ucs_ip_pool/tasks/main.yml b/test/integration/targets/ucs_ip_pool/tasks/main.yml deleted file mode 100644 index 696b291d8e7..00000000000 --- a/test/integration/targets/ucs_ip_pool/tasks/main.yml +++ /dev/null @@ -1,203 +0,0 @@ -# Test code for the UCS modules -# Copyright 2017, David Soper (@dsoper2) - -- name: Test that we have a UCS host, UCS username, and UCS password - fail: - msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' - when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined - vars: - login_info: &login_info - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - -# Setup (clean environment) -- name: IPv4 Pools absent - ucs_ip_pool: &ipv4_pool_absent - <<: *login_info - name: ip-A - state: absent -- name: IPv6 Pools absent - ucs_ip_pool: &ipv6_pool_absent - <<: *login_info - name: ipv6-B - state: absent - - -# Test present (check_mode) -- name: IPv4 Pools present (check_mode) - ucs_ip_pool: &ipv4_pool_present - <<: *login_info - name: ip-A - order: sequential - first_addr: 192.168.0.10 - last_addr: 192.168.0.19 - subnet_mask: 255.255.255.0 - default_gw: 192.168.0.1 - primary_dns: 172.16.143.136 - check_mode: yes - register: cm_ipv4_pool_present - -- name: IPv6 Pools present (check_mode) - ucs_ip_pool: &ipv6_pool_present - <<: *login_info - name: ipv6-B - ipv6_first_addr: fe80::1cae:7992:d7a1:ed07 - ipv6_last_addr: fe80::1cae:7992:d7a1:edfe - ipv6_default_gw: fe80::1cae:7992:d7a1:ecff - check_mode: yes - register: cm_ipv6_pool_present - - -# Present (normal mode) -- name: IPv4 Pools present (normal mode) - ucs_ip_pool: *ipv4_pool_present - register: nm_ipv4_pool_present - -- name: IPv6 Pools present (normal mode) - ucs_ip_pool: *ipv6_pool_present - register: nm_ipv6_pool_present - - -# Test present again (idempotent) -- name: IPv4 Pools present again (check_mode) - ucs_ip_pool: *ipv4_pool_present - check_mode: yes - register: cm_ipv4_pool_present_again - -- name: IPv6 Pools present again (check_mode) - ucs_ip_pool: *ipv6_pool_present - check_mode: yes - register: cm_ipv6_pool_present_again - - -# Present again (normal mode) -- name: IPv4 Pools present again (normal mode) - ucs_ip_pool: *ipv4_pool_present - register: nm_ipv4_pool_present_again - -- name: IPv6 Pools present again (normal mode) - ucs_ip_pool: *ipv6_pool_present - register: nm_ipv6_pool_present_again - - -# Verfiy present -- name: Verify IPv4/IPv6 Pools present results - assert: - that: - - cm_ipv4_pool_present.changed == nm_ipv4_pool_present.changed == true - - cm_ipv6_pool_present.changed == nm_ipv6_pool_present.changed == true - - cm_ipv4_pool_present_again.changed == nm_ipv4_pool_present_again.changed == false - - cm_ipv6_pool_present_again.changed == nm_ipv6_pool_present_again.changed == false - - -# Test change (check_mode) -- name: IPv4 Pools description change (check_mode) - ucs_ip_pool: &ipv4_pool_change - <<: *ipv4_pool_present - descr: Testing Ansible - check_mode: yes - register: cm_ipv4_pool_descr_change - -- name: IPv6 Pools description change (check_mode) - ucs_ip_pool: &ipv6_pool_change - <<: *ipv6_pool_present - descr: Testing Ansible - check_mode: yes - register: cm_ipv6_pool_descr_change - - -# Change (normal mode) -- name: IPv4 Pools description change (normal mode) - ucs_ip_pool: *ipv4_pool_change - register: nm_ipv4_pool_descr_change - -- name: IPv6 Pools description change (normal mode) - ucs_ip_pool: *ipv6_pool_change - register: nm_ipv6_pool_descr_change - - -# Test change again (idempotent) -- name: IPv4 Pools description again (check_mode) - ucs_ip_pool: *ipv4_pool_change - check_mode: yes - register: cm_ipv4_pool_descr_change_again - -- name: IPv6 Pools description again (check_mode) - ucs_ip_pool: *ipv6_pool_change - check_mode: yes - register: cm_ipv6_pool_descr_change_again - - -# Change again (normal mode) -- name: IPv4 Pools description change again (normal mode) - ucs_ip_pool: *ipv4_pool_change - register: nm_ipv4_pool_descr_change_again - -- name: IPv6 Pools description change again (normal mode) - ucs_ip_pool: *ipv6_pool_change - register: nm_ipv6_pool_descr_change_again - - -# Verfiy change -- name: Verify IPv4/IPv6 Pools change results - assert: - that: - - cm_ipv4_pool_descr_change.changed == nm_ipv4_pool_descr_change.changed == true - - cm_ipv4_pool_descr_change_again.changed == nm_ipv4_pool_descr_change_again.changed == false - - cm_ipv6_pool_descr_change.changed == nm_ipv6_pool_descr_change.changed == true - - cm_ipv6_pool_descr_change_again.changed == nm_ipv6_pool_descr_change_again.changed == false - - -# Teardown (clean environment) -- name: IPv4 Pools absent (check_mode) - ucs_ip_pool: *ipv4_pool_absent - check_mode: yes - register: cm_ipv4_pool_absent - -- name: IPv6 Pools absent (check_mode) - ucs_ip_pool: *ipv6_pool_absent - check_mode: yes - register: cm_ipv6_pool_absent - - -# Absent (normal mode) -- name: IPv4 Pools absent (normal mode) - ucs_ip_pool: *ipv4_pool_absent - register: nm_ipv4_pool_absent - -- name: IPv6 Pools absent (normal mode) - ucs_ip_pool: *ipv6_pool_absent - register: nm_ipv6_pool_absent - - -# Test absent again (idempotent) -- name: IPv4 Pools absent again (check_mode) - ucs_ip_pool: *ipv4_pool_absent - check_mode: yes - register: cm_ipv4_pool_absent_again - -- name: IPv6 Pools absent again (check_mode) - ucs_ip_pool: *ipv6_pool_absent - check_mode: yes - register: cm_ipv6_pool_absent_again - - -# Absent again (normal mode) -- name: IPv4 Pools absent again (normal mode) - ucs_ip_pool: *ipv4_pool_absent - register: nm_ipv4_pool_absent_again - -- name: IPv6 Pools absent again (normal mode) - ucs_ip_pool: *ipv6_pool_absent - register: nm_ipv6_pool_absent_again - - -# Verfiy absent -- name: Verify IPv4/IPv6 Pools absent results - assert: - that: - - cm_ipv4_pool_absent.changed == nm_ipv4_pool_absent.changed == true - - cm_ipv4_pool_absent_again.changed == nm_ipv4_pool_absent_again.changed == false - - cm_ipv6_pool_absent.changed == nm_ipv6_pool_absent.changed == true - - cm_ipv6_pool_absent_again.changed == nm_ipv6_pool_absent_again.changed == false diff --git a/test/integration/targets/ucs_lan_connectivity/aliases b/test/integration/targets/ucs_lan_connectivity/aliases deleted file mode 100644 index 0689fba3e4a..00000000000 --- a/test/integration/targets/ucs_lan_connectivity/aliases +++ /dev/null @@ -1,7 +0,0 @@ -# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware. -# Example integration_config.yml: -# --- -# ucs_hostname: 172.16.143.136 -# ucs_username: admin -# ucs_password: password -unsupported diff --git a/test/integration/targets/ucs_lan_connectivity/tasks/main.yml b/test/integration/targets/ucs_lan_connectivity/tasks/main.yml deleted file mode 100644 index c853d310f83..00000000000 --- a/test/integration/targets/ucs_lan_connectivity/tasks/main.yml +++ /dev/null @@ -1,202 +0,0 @@ -# Test code for the UCS modules -# Copyright 2017, David Soper (@dsoper2) - -- name: Test that we have a UCS host, UCS username, and UCS password - fail: - msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' - when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined - vars: - login_info: &login_info - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - -# Setup (clean environment) -- name: LAN Connectivity Policies absent - ucs_lan_connectivity: &lan_connectivity_absent - <<: *login_info - name: Cntr-FC-Boot - state: absent - -# Test present (check_mode) -- name: LAN Connectivity Policies present (check_mode) - ucs_lan_connectivity: &lan_connectivity_present - <<: *login_info - 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 - check_mode: yes - register: cm_lan_connectivity_present - -# Present (normal mode) -- name: LAN Connectivity Policies present (normal mode) - ucs_lan_connectivity: *lan_connectivity_present - register: nm_lan_connectivity_present - -# Test present again (idempotent) -- name: LAN Connectivity Policies present again (check_mode) - ucs_lan_connectivity: *lan_connectivity_present - check_mode: yes - register: cm_lan_connectivity_present_again - -# Present again (normal mode) -- name: LAN Connectivity Policies present again (normal mode) - ucs_lan_connectivity: *lan_connectivity_present - register: nm_lan_connectivity_present_again - -# Verfiy present -- name: Verify LAN Connectivity Policies present results - assert: - that: - - cm_lan_connectivity_present.changed == nm_lan_connectivity_present.changed == true - - cm_lan_connectivity_present_again.changed == nm_lan_connectivity_present_again.changed == false - -# Test change (check_mode) -- name: LAN Connectivity Policies change (check_mode) - ucs_lan_connectivity: &lan_connectivity_change - <<: *login_info - 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: default - 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 - check_mode: yes - register: cm_lan_connectivity_descr_change - -# Change (normal mode) -- name: LAN Connectivity Policies description change (normal mode) - ucs_lan_connectivity: *lan_connectivity_change - register: nm_lan_connectivity_descr_change - -# Test change again (idempotent) -- name: LAN Connectivity Policies description again (check_mode) - ucs_lan_connectivity: *lan_connectivity_change - check_mode: yes - register: cm_lan_connectivity_descr_change_again - -# Change again (normal mode) -- name: LAN Connectivity Policies description change again (normal mode) - ucs_lan_connectivity: *lan_connectivity_change - register: nm_lan_connectivity_descr_change_again - -# Verfiy change -- name: Verify LAN Connectivity Policies change results - assert: - that: - - cm_lan_connectivity_descr_change.changed == nm_lan_connectivity_descr_change.changed == true - - cm_lan_connectivity_descr_change_again.changed == nm_lan_connectivity_descr_change_again.changed == false - - -# Test vnic and iscsi vnic removal -- name: LAN Connectivity Policies vnic removal (check_mode) - ucs_lan_connectivity: &lan_connectivity_vnic_change - <<: *login_info - 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: default - state: absent - iscsi_vnic_list: - - name: iSCSIa - overlay_vnic: eno1 - iscsi_adapter_policy: default - vlan_name: Container-MGMT-VLAN - state: absent - - name: iSCSIb - overlay_vnic: eno3 - iscsi_adapter_policy: default - vlan_name: Container-TNT-A-NFS - state: absent - check_mode: yes - register: cm_lan_connectivity_vnic_change - -# Change (normal mode) -- name: LAN Connectivity Policies vnic removal (normal mode) - ucs_lan_connectivity: *lan_connectivity_vnic_change - register: nm_lan_connectivity_vnic_change - -# Test change again (idempotent) -- name: LAN Connectivity Policies vnic removal again (check_mode) - ucs_lan_connectivity: *lan_connectivity_vnic_change - check_mode: yes - register: cm_lan_connectivity_vnic_change_again - -# Change again (normal mode) -- name: LAN Connectivity Policies vnic removal again (normal mode) - ucs_lan_connectivity: *lan_connectivity_vnic_change - register: nm_lan_connectivity_vnic_change_again - -# Verfiy change -- name: Verify LAN Connectivity Policies vnic removal results - assert: - that: - - cm_lan_connectivity_vnic_change.changed == nm_lan_connectivity_vnic_change.changed == true - - cm_lan_connectivity_vnic_change_again.changed == nm_lan_connectivity_vnic_change_again.changed == false - -# Teardown (clean environment) -- name: LAN Connectivity Policies absent (check_mode) - ucs_lan_connectivity: *lan_connectivity_absent - check_mode: yes - register: cm_lan_connectivity_absent - -# Absent (normal mode) -- name: LAN Connectivity Policies absent (normal mode) - ucs_lan_connectivity: *lan_connectivity_absent - register: nm_lan_connectivity_absent - -# Test absent again (idempotent) -- name: LAN Connectivity Policies absent again (check_mode) - ucs_lan_connectivity: *lan_connectivity_absent - check_mode: yes - register: cm_lan_connectivity_absent_again - -# Absent again (normal mode) -- name: LAN Connectivity Policies absent again (normal mode) - ucs_lan_connectivity: *lan_connectivity_absent - register: nm_lan_connectivity_absent_again - -# Verfiy absent -- name: Verify LAN Connectivity Policies absent results - assert: - that: - - cm_lan_connectivity_absent.changed == nm_lan_connectivity_absent.changed == true - - cm_lan_connectivity_absent_again.changed == nm_lan_connectivity_absent_again.changed == false diff --git a/test/integration/targets/ucs_mac_pool/aliases b/test/integration/targets/ucs_mac_pool/aliases deleted file mode 100644 index 0689fba3e4a..00000000000 --- a/test/integration/targets/ucs_mac_pool/aliases +++ /dev/null @@ -1,7 +0,0 @@ -# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware. -# Example integration_config.yml: -# --- -# ucs_hostname: 172.16.143.136 -# ucs_username: admin -# ucs_password: password -unsupported diff --git a/test/integration/targets/ucs_mac_pool/tasks/main.yml b/test/integration/targets/ucs_mac_pool/tasks/main.yml deleted file mode 100644 index ebb6bb8757e..00000000000 --- a/test/integration/targets/ucs_mac_pool/tasks/main.yml +++ /dev/null @@ -1,129 +0,0 @@ -# Test code for the UCS modules -# Copyright 2017, David Soper (@dsoper2) - -- name: Test that we have a UCS host, UCS username, and UCS password - fail: - msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' - when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined - vars: - login_info: &login_info - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - - -# Setup (clean environment) -- name: MAC pools absent - ucs_mac_pool: &mac_pools_absent - <<: *login_info - name: mac-A - state: absent - - -# Test present (check_mode) -- name: MAC pools present (check_mode) - ucs_mac_pool: &mac_pools_present - <<: *login_info - name: mac-A - first_addr: 00:25:B5:00:66:00 - last_addr: 00:25:B5:00:67:F3 - order: sequential - check_mode: yes - register: cm_mac_pools_present - - -# Present (normal mode) -- name: MAC pools present (normal mode) - ucs_mac_pool: *mac_pools_present - register: nm_mac_pools_present - - -# Test present again (idempotent) -- name: MAC pools present again (check_mode) - ucs_mac_pool: *mac_pools_present - check_mode: yes - register: cm_mac_pools_present_again - - -# Present again (normal mode) -- name: MAC pools present again (normal mode) - ucs_mac_pool: *mac_pools_present - register: nm_mac_pools_present_again - - -# Verfiy present -- name: Verify MAC present results - assert: - that: - - cm_mac_pools_present.changed == nm_mac_pools_present.changed == true - - cm_mac_pools_present_again.changed == nm_mac_pools_present_again.changed == false - - -# Test change (check_mode) -- name: MAC pools description change (check_mode) - ucs_mac_pool: &mac_pools_change - <<: *mac_pools_present - descr: Testing Ansible - check_mode: yes - register: cm_mac_pools_descr_change - - -# Change (normal mode) -- name: MAC pools description change (normal mode) - ucs_mac_pool: *mac_pools_change - register: nm_mac_pools_descr_change - - -# Test change again (idempotent) -- name: MAC pools description again (check_mode) - ucs_mac_pool: *mac_pools_change - check_mode: yes - register: cm_mac_pools_descr_change_again - - -# Change again (normal mode) -- name: MAC pools description change again (normal mode) - ucs_mac_pool: *mac_pools_change - register: nm_mac_pools_descr_change_again - - -# Verfiy change -- name: Verify MAC change results - assert: - that: - - cm_mac_pools_descr_change.changed == nm_mac_pools_descr_change.changed == true - - cm_mac_pools_descr_change_again.changed == nm_mac_pools_descr_change_again.changed == false - - -# Teardown (clean environment) -- name: MAC pools absent (check_mode) - ucs_mac_pool: *mac_pools_absent - check_mode: yes - register: cm_mac_pools_absent - - -# Absent (normal mode) -- name: MAC pools absent (normal mode) - ucs_mac_pool: *mac_pools_absent - register: nm_mac_pools_absent - - -# Test absent again (idempotent) -- name: MAC pools absent again (check_mode) - ucs_mac_pool: *mac_pools_absent - check_mode: yes - register: cm_mac_pools_absent_again - - -# Absent again (normal mode) -- name: MAC pools absent again (normal mode) - ucs_mac_pool: *mac_pools_absent - register: nm_mac_pools_absent_again - - -# Verfiy absent -- name: Verify MAC absent results - assert: - that: - - cm_mac_pools_absent.changed == nm_mac_pools_absent.changed == true - - cm_mac_pools_absent_again.changed == nm_mac_pools_absent_again.changed == false diff --git a/test/integration/targets/ucs_managed_objects/aliases b/test/integration/targets/ucs_managed_objects/aliases deleted file mode 100644 index 0689fba3e4a..00000000000 --- a/test/integration/targets/ucs_managed_objects/aliases +++ /dev/null @@ -1,7 +0,0 @@ -# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware. -# Example integration_config.yml: -# --- -# ucs_hostname: 172.16.143.136 -# ucs_username: admin -# ucs_password: password -unsupported diff --git a/test/integration/targets/ucs_managed_objects/tasks/main.yml b/test/integration/targets/ucs_managed_objects/tasks/main.yml deleted file mode 100644 index a3b38b8ad41..00000000000 --- a/test/integration/targets/ucs_managed_objects/tasks/main.yml +++ /dev/null @@ -1,360 +0,0 @@ -# Test code for the UCS modules -# Copyright 2018, David Soper (@dsoper2) - -- name: Test that we have a UCS host, UCS username, and UCS password - fail: - msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' - when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined - vars: - login_info: &login_info - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - -# Setup (clean environment) -- name: Remove Network Control Policy - ucs_managed_objects: &managed_objects_absent - <<: *login_info - objects: - - module: ucsmsdk.mometa.nwctrl.NwctrlDefinition - class: NwctrlDefinition - properties: - parent_mo_or_dn: org-root - name: Enable-CDP-LLDP - state: absent - - -# Test present (check_mode) -- name: Configure Network Control Policy - ucs_managed_objects: &managed_objects_present - <<: *login_info - 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 - check_mode: yes - register: cm_managed_objects_present - - -# Present (normal mode) -- name: Managed Objects present (normal mode) - ucs_managed_objects: *managed_objects_present - register: nm_managed_objects_present - - -# Test present again (idempotent) -- name: Managed Objects present again (check_mode) - ucs_managed_objects: *managed_objects_present - check_mode: yes - register: cm_managed_objects_present_again - - -# Present again (normal mode) -- name: Managed Objects present again (normal mode) - ucs_managed_objects: *managed_objects_present - register: nm_managed_objects_present_again - - -# Verfiy present -- name: Verify Managed Objects present results - assert: - that: - - cm_managed_objects_present.changed == nm_managed_objects_present.changed == true - - cm_managed_objects_present_again.changed == nm_managed_objects_present_again.changed == false - - -# Test change (check_mode) -- name: Managed Objects change (check_mode) - ucs_managed_objects: &managed_objects_change - <<: *login_info - objects: - - module: ucsmsdk.mometa.nwctrl.NwctrlDefinition - class: NwctrlDefinition - properties: - parent_mo_or_dn: org-root - cdp: enabled - descr: Testing Ansible - lldp_receive: enabled - lldp_transmit: enabled - name: Enable-CDP-LLDP - check_mode: yes - register: cm_managed_objects_change - - -# Change (normal mode) -- name: Managed Objects change (normal mode) - ucs_managed_objects: *managed_objects_change - register: nm_managed_objects_change - - -# Test change again (idempotent) -- name: Managed Objects again (check_mode) - ucs_managed_objects: *managed_objects_change - check_mode: yes - register: cm_managed_objects_change_again - - -# Change again (normal mode) -- name: Managed Objects change again (normal mode) - ucs_managed_objects: *managed_objects_change - register: nm_managed_objects_change_again - - -# Verfiy change -- name: Verify Managed Objects change results - assert: - that: - - cm_managed_objects_change.changed == nm_managed_objects_change.changed == true - - cm_managed_objects_change_again.changed == nm_managed_objects_change_again.changed == false - - -# Teardown (clean environment) -- name: Managed Objects absent (check_mode) - ucs_managed_objects: *managed_objects_absent - check_mode: yes - register: cm_managed_objects_absent - - -# Absent (normal mode) -- name: Managed Objects absent (normal mode) - ucs_managed_objects: *managed_objects_absent - register: nm_managed_objects_absent - - -# Test absent again (idempotent) -- name: Managed Objects absent again (check_mode) - ucs_managed_objects: *managed_objects_absent - check_mode: yes - register: cm_managed_objects_absent_again - - -# Absent again (normal mode) -- name: Managed Objects absent again (normal mode) - ucs_managed_objects: *managed_objects_absent - register: nm_managed_objects_absent_again - - -# Verfiy absent -- name: Verify Managed Objects absent results - assert: - that: - - cm_managed_objects_absent.changed == nm_managed_objects_absent.changed == true - - cm_managed_objects_absent_again.changed == nm_managed_objects_absent_again.changed == false - - -# Setup Boot Policy (clean environment) -- name: Remove Boot Policy - ucs_managed_objects: &boot_managed_objects_absent - <<: *login_info - objects: - - { - "module": "ucsmsdk.mometa.lsboot.LsbootPolicy", - "class": "LsbootPolicy", - "properties": { - "parent_mo_or_dn": "org-root", - "name": "Python_SDS" - } - } - state: absent - - -# Test present (check_mode) -- name: Configure Boot Policy - ucs_managed_objects: &boot_managed_objects_present - <<: *login_info - 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" - } - } - ] - } - ] - } - ] - } - check_mode: yes - register: cm_boot_managed_objects_present - - -# Present (normal mode) -- name: Boot Managed Objects present (normal mode) - ucs_managed_objects: *boot_managed_objects_present - register: nm_boot_managed_objects_present - - -# Test present again (idempotent) -- name: Boot Managed Objects present again (check_mode) - ucs_managed_objects: *boot_managed_objects_present - check_mode: yes - register: cm_boot_managed_objects_present_again - - -# Present again (normal mode) -- name: Boot Managed Objects present again (normal mode) - ucs_managed_objects: *boot_managed_objects_present - register: nm_boot_managed_objects_present_again - - -# Verfiy present -- name: Verify Boot Managed Objects present results - assert: - that: - - cm_boot_managed_objects_present.changed == nm_boot_managed_objects_present.changed == true - - cm_boot_managed_objects_present_again.changed == nm_boot_managed_objects_present_again.changed == false - - -# Test change (check_mode) -- name: Boot Managed Objects change (check_mode) - ucs_managed_objects: &boot_managed_objects_change - <<: *login_info - 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": "yes" - }, - "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" - } - } - ] - } - ] - } - ] - } - check_mode: yes - register: cm_boot_managed_objects_change - - -# Change (normal mode) -- name: Boot Managed Objects change (normal mode) - ucs_managed_objects: *boot_managed_objects_change - register: nm_boot_managed_objects_change - - -# Test change again (idempotent) -- name: Boot Managed Objects again (check_mode) - ucs_managed_objects: *boot_managed_objects_change - check_mode: yes - register: cm_boot_managed_objects_change_again - - -# Change again (normal mode) -- name: Boot Managed Objects change again (normal mode) - ucs_managed_objects: *boot_managed_objects_change - register: nm_boot_managed_objects_change_again - - -# Verfiy change -- name: Verify Boot Managed Objects change results - assert: - that: - - cm_boot_managed_objects_change.changed == nm_boot_managed_objects_change.changed == true - - cm_boot_managed_objects_change_again.changed == nm_boot_managed_objects_change_again.changed == false - - -# Teardown (clean environment) -- name: Boot Managed Objects absent (check_mode) - ucs_managed_objects: *boot_managed_objects_absent - check_mode: yes - register: cm_boot_managed_objects_absent - - -# Absent (normal mode) -- name: Boot Managed Objects absent (normal mode) - ucs_managed_objects: *boot_managed_objects_absent - register: nm_boot_managed_objects_absent - - -# Test absent again (idempotent) -- name: Boot Managed Objects absent again (check_mode) - ucs_managed_objects: *boot_managed_objects_absent - check_mode: yes - register: cm_boot_managed_objects_absent_again - - -# Absent again (normal mode) -- name: Boot Managed Objects absent again (normal mode) - ucs_managed_objects: *boot_managed_objects_absent - register: nm_boot_managed_objects_absent_again - - -# Verfiy absent -- name: Verify Boot Managed Objects absent results - assert: - that: - - cm_boot_managed_objects_absent.changed == nm_boot_managed_objects_absent.changed == true - - cm_boot_managed_objects_absent_again.changed == nm_boot_managed_objects_absent_again.changed == false diff --git a/test/integration/targets/ucs_ntp_server/aliases b/test/integration/targets/ucs_ntp_server/aliases deleted file mode 100644 index 16a714d47ac..00000000000 --- a/test/integration/targets/ucs_ntp_server/aliases +++ /dev/null @@ -1,7 +0,0 @@ -# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware. -# Example integration_config.yml: -# --- -# ucs_hostname: 172.22.251.170 -# ucs_username: admin -# ucs_password: password -unsupported \ No newline at end of file diff --git a/test/integration/targets/ucs_ntp_server/tasks/main.yml b/test/integration/targets/ucs_ntp_server/tasks/main.yml deleted file mode 100644 index 8e75fc82ebc..00000000000 --- a/test/integration/targets/ucs_ntp_server/tasks/main.yml +++ /dev/null @@ -1,110 +0,0 @@ -# Test code for the UCS modules -# Copyright 2018, John McDonough (@movinalot) - -- name: Test that we have a UCS host, UCS username, and UCS password - fail: - msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' - when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined - vars: - login_info: &login_info - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - -# Setup (clean environment) -- name: NTP Server absent - ucs_ntp_server: &ntp_server_absent - <<: *login_info - ntp_server: pool.ntp.org - state: absent - -# Test present (check_mode) -- name: NTP Server present (check_mode) - ucs_ntp_server: &ntp_server_present - <<: *login_info - ntp_server: pool.ntp.org - check_mode: yes - register: cm_ntp_server_present - -# Present (normal mode) -- name: NTP Server present (normal mode) - ucs_ntp_server: *ntp_server_present - register: nm_ntp_server_present - -# Test present again (idempotent) -- name: NTP Server present again (check_mode) - ucs_ntp_server: *ntp_server_present - check_mode: yes - register: cm_ntp_server_present_again - -# Present again (normal mode) -- name: NTP Server present again (normal mode) - ucs_ntp_server: *ntp_server_present - register: nm_ntp_server_present_again - -# Verfiy present -- name: Verify NTP Server present results - assert: - that: - - cm_ntp_server_present.changed == nm_ntp_server_present.changed == true - - cm_ntp_server_present_again.changed == nm_ntp_server_present_again.changed == false - -# Test change (check_mode) -- name: NTP NTP Server change (check_mode) - ucs_ntp_server: &ntp_server_change - <<: *ntp_server_present - ntp_server: 10.10.10.10 - check_mode: yes - register: cm_ntp_ntp_server_change - -# Change (normal mode) -- name: NTP NTP Server change (normal mode) - ucs_ntp_server: *ntp_server_change - register: nm_ntp_ntp_server_change - -# Test change again (idempotent) -- name: NTP NTP Server change again (check_mode) - ucs_ntp_server: *ntp_server_change - check_mode: yes - register: cm_ntp_ntp_server_change_again - -# Change again (normal mode) -- name: NTP NTP Server change again (normal mode) - ucs_ntp_server: *ntp_server_change - register: nm_ntp_ntp_server_change_again - -# Verfiy change -- name: Verify NTP NTP Server change results - assert: - that: - - cm_ntp_ntp_server_change.changed == nm_ntp_ntp_server_change.changed == true - - cm_ntp_ntp_server_change_again.changed == nm_ntp_ntp_server_change_again.changed == false - -# Teardown (clean environment) -- name: NTP Server absent (check_mode) - ucs_ntp_server: *ntp_server_absent - check_mode: yes - register: cm_ntp_server_absent - -# Absent (normal mode) -- name: NTP Server absent (normal mode) - ucs_ntp_server: *ntp_server_absent - register: nm_ntp_server_absent - -# Test absent again (idempotent) -- name: NTP Server absent again (check_mode) - ucs_ntp_server: *ntp_server_absent - check_mode: yes - register: cm_ntp_server_absent_again - -# Absent again (normal mode) -- name: NTP Server absent again (normal mode) - ucs_ntp_server: *ntp_server_absent - register: nm_ntp_server_absent_again - -# Verfiy absent -- name: Verify NTP Server absent results - assert: - that: - - cm_ntp_server_absent.changed == nm_ntp_server_absent.changed == true - - cm_ntp_server_absent_again.changed == nm_ntp_server_absent_again.changed == false diff --git a/test/integration/targets/ucs_org/aliases b/test/integration/targets/ucs_org/aliases deleted file mode 100644 index 0689fba3e4a..00000000000 --- a/test/integration/targets/ucs_org/aliases +++ /dev/null @@ -1,7 +0,0 @@ -# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware. -# Example integration_config.yml: -# --- -# ucs_hostname: 172.16.143.136 -# ucs_username: admin -# ucs_password: password -unsupported diff --git a/test/integration/targets/ucs_org/tasks/main.yml b/test/integration/targets/ucs_org/tasks/main.yml deleted file mode 100644 index 13c0294d295..00000000000 --- a/test/integration/targets/ucs_org/tasks/main.yml +++ /dev/null @@ -1,123 +0,0 @@ -# Test code for the UCS Org module -# Copyright 2018, John McDonough (@movinalot) - -- name: Test that we have a UCS host, UCS username, and UCS password - fail: - msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' - when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined - vars: - login_info: &login_info - <<: *login_info - -# Setup (clean environment) -- name: org absent - ucs_org: &org_absent - <<: *login_info - org_name: testorg - state: absent - - -# Test present (check_mode) -- name: org present (check_mode) - ucs_org: &org_present - <<: *login_info - org_name: testorg - check_mode: yes - register: cm_org_present - - -# Present (normal mode) -- name: org present (normal mode) - ucs_org: *org_present - register: nm_org_present - - -# Test present again (idempotent) -- name: org present again (check_mode) - ucs_org: *org_present - check_mode: yes - register: cm_org_present_again - - -# Present again (normal mode) -- name: org present again (normal mode) - ucs_org: *org_present - register: nm_org_present_again - - -# Verfiy present -- name: Verify org present results - assert: - that: - - cm_org_present.changed == nm_org_present.changed == true - - cm_org_present_again.changed == nm_org_present_again.changed == false - - -# Test change (check_mode) -- name: org description change (check_mode) - ucs_org: &org_change - <<: *org_present - description: 'testorg' - check_mode: yes - register: cm_org_description_change - - -# Change (normal mode) -- name: org description change (normal mode) - ucs_org: *org_change - register: nm_org_description_change - - -# Test change again (idempotent) -- name: org description change again (check_mode) - ucs_org: *org_change - check_mode: yes - register: cm_org_description_change_again - - -# Change again (normal mode) -- name: org description change again (normal mode) - ucs_org: *org_change - register: nm_org_description_change_again - - -# Verfiy change -- name: Verify org change results - assert: - that: - - cm_org_description_change.changed == nm_org_description_change.changed == true - - cm_org_description_change_again.changed == nm_org_description_change_again.changed == false - - -# Teardown (clean environment) -- name: org absent (check_mode) - ucs_org: *org_absent - check_mode: yes - register: cm_org_absent - - -# Absent (normal mode) -- name: org absent (normal mode) - ucs_org: *org_absent - register: nm_org_absent - - -# Test absent again (idempotent) -- name: org absent again (check_mode) - ucs_org: *org_absent - check_mode: yes - register: cm_org_absent_again - - -# Absent again (normal mode) -- name: org absent again (normal mode) - ucs_org: *org_absent - register: nm_org_absent_again - - -# Verfiy absent -- name: Verify org absent results - assert: - that: - - cm_org_absent.changed == nm_org_absent.changed == true - - cm_org_absent_again.changed == nm_org_absent_again.changed == false diff --git a/test/integration/targets/ucs_query/aliases b/test/integration/targets/ucs_query/aliases deleted file mode 100644 index 0689fba3e4a..00000000000 --- a/test/integration/targets/ucs_query/aliases +++ /dev/null @@ -1,7 +0,0 @@ -# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware. -# Example integration_config.yml: -# --- -# ucs_hostname: 172.16.143.136 -# ucs_username: admin -# ucs_password: password -unsupported diff --git a/test/integration/targets/ucs_query/tasks/main.yml b/test/integration/targets/ucs_query/tasks/main.yml deleted file mode 100644 index 87e453a6338..00000000000 --- a/test/integration/targets/ucs_query/tasks/main.yml +++ /dev/null @@ -1,42 +0,0 @@ -# Test code for the UCS Query module -# Copyright 2019, John McDonough (@movinalot) - -- name: Test that we have a UCS host, UCS username, and UCS password - fail: - msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' - when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined - vars: - login_info: &login_info - <<: *login_info - -# Query for Class ID -- name: Query Class ID - ucs_query: - <<: *login_info - class_ids: computeBlade - delegate_to: localhost - register: single_class - -# Query for Class IDs -- name: Query Class IDs - ucs_query: - <<: *login_info - class_ids: computeBlade, fabricVlan - delegate_to: localhost - register: multiple_classes - -# Query for Dn -- name: Query Dn - ucs_query: - <<: *login_info - distinguished_names: org-root - delegate_to: localhost - register: single_dn - -# Query for Dn -- name: Query Dns - ucs_query: - <<: *login_info - distinguished_names: org-root, sys/rack-unit-1, sys/chassis-1/blade-2 - delegate_to: localhost - register: multiple_dns diff --git a/test/integration/targets/ucs_san_connectivity/aliases b/test/integration/targets/ucs_san_connectivity/aliases deleted file mode 100644 index 0689fba3e4a..00000000000 --- a/test/integration/targets/ucs_san_connectivity/aliases +++ /dev/null @@ -1,7 +0,0 @@ -# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware. -# Example integration_config.yml: -# --- -# ucs_hostname: 172.16.143.136 -# ucs_username: admin -# ucs_password: password -unsupported diff --git a/test/integration/targets/ucs_san_connectivity/tasks/main.yml b/test/integration/targets/ucs_san_connectivity/tasks/main.yml deleted file mode 100644 index c237dd1c09b..00000000000 --- a/test/integration/targets/ucs_san_connectivity/tasks/main.yml +++ /dev/null @@ -1,132 +0,0 @@ -# Test code for the UCS modules -# Copyright 2017, David Soper (@dsoper2) - -- name: Test that we have a UCS host, UCS username, and UCS password - fail: - msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' - when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined - - -# Setup (clean environment) -- name: SAN Connectivity Policies absent - ucs_san_connectivity: &san_connectivity_absent - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - name: Cntr-FC-Boot - state: absent - -# Test present (check_mode) -- name: SAN Connectivity Policies present (check_mode) - ucs_san_connectivity: &san_connectivity_present - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - name: Cntr-FC-Boot - wwnn_pool: WWNN-Pool - vhba_list: - - name: Fabric-A - vhba_template: vHBA-Template-A - adapter_policy: Linux - - name: Fabric-B - vhba_template: vHBA-Template-B - adapter_policy: Linux - check_mode: yes - register: cm_san_connectivity_present - - -# Present (normal mode) -- name: SAN Connectivity Policies present (normal mode) - ucs_san_connectivity: *san_connectivity_present - register: nm_san_connectivity_present - - -# Test present again (idempotent) -- name: SAN Connectivity Policies present again (check_mode) - ucs_san_connectivity: *san_connectivity_present - check_mode: yes - register: cm_san_connectivity_present_again - - -# Present again (normal mode) -- name: SAN Connectivity Policies present again (normal mode) - ucs_san_connectivity: *san_connectivity_present - register: nm_san_connectivity_present_again - - -# Verfiy present -- name: Verify SAN Connectivity Policies present results - assert: - that: - - cm_san_connectivity_present.changed == nm_san_connectivity_present.changed == true - - cm_san_connectivity_present_again.changed == nm_san_connectivity_present_again.changed == false - - -# Test change (check_mode) -- name: SAN Connectivity Policies description change (check_mode) - ucs_san_connectivity: &san_connectivity_change - <<: *san_connectivity_present - descr: Testing Ansible - check_mode: yes - register: cm_san_connectivity_descr_change - - -# Change (normal mode) -- name: SAN Connectivity Policies description change (normal mode) - ucs_san_connectivity: *san_connectivity_change - register: nm_san_connectivity_descr_change - - -# Test change again (idempotent) -- name: SAN Connectivity Policies description again (check_mode) - ucs_san_connectivity: *san_connectivity_change - check_mode: yes - register: cm_san_connectivity_descr_change_again - - -# Change again (normal mode) -- name: SAN Connectivity Policies description change again (normal mode) - ucs_san_connectivity: *san_connectivity_change - register: nm_san_connectivity_descr_change_again - - -# Verfiy change -- name: Verify SAN Connectivity Policies change results - assert: - that: - - cm_san_connectivity_descr_change.changed == nm_san_connectivity_descr_change.changed == true - - cm_san_connectivity_descr_change_again.changed == nm_san_connectivity_descr_change_again.changed == false - - -# Teardown (clean environment) -- name: SAN Connectivity Policies absent (check_mode) - ucs_san_connectivity: *san_connectivity_absent - check_mode: yes - register: cm_san_connectivity_absent - - -# Absent (normal mode) -- name: SAN Connectivity Policies absent (normal mode) - ucs_san_connectivity: *san_connectivity_absent - register: nm_san_connectivity_absent - - -# Test absent again (idempotent) -- name: SAN Connectivity Policies absent again (check_mode) - ucs_san_connectivity: *san_connectivity_absent - check_mode: yes - register: cm_san_connectivity_absent_again - - -# Absent again (normal mode) -- name: SAN Connectivity Policies absent again (normal mode) - ucs_san_connectivity: *san_connectivity_absent - register: nm_san_connectivity_absent_again - - -# Verfiy absent -- name: Verify SAN Connectivity Policies absent results - assert: - that: - - cm_san_connectivity_absent.changed == nm_san_connectivity_absent.changed == true - - cm_san_connectivity_absent_again.changed == nm_san_connectivity_absent_again.changed == false diff --git a/test/integration/targets/ucs_service_profile_template/aliases b/test/integration/targets/ucs_service_profile_template/aliases deleted file mode 100644 index 0689fba3e4a..00000000000 --- a/test/integration/targets/ucs_service_profile_template/aliases +++ /dev/null @@ -1,7 +0,0 @@ -# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware. -# Example integration_config.yml: -# --- -# ucs_hostname: 172.16.143.136 -# ucs_username: admin -# ucs_password: password -unsupported diff --git a/test/integration/targets/ucs_service_profile_template/tasks/main.yml b/test/integration/targets/ucs_service_profile_template/tasks/main.yml deleted file mode 100644 index cdc6bcb1e47..00000000000 --- a/test/integration/targets/ucs_service_profile_template/tasks/main.yml +++ /dev/null @@ -1,147 +0,0 @@ -# Test code for the UCS modules -# Copyright 2018, David Soper (@dsoper2) - -- name: Test that we have a UCS host, UCS username, and UCS password - fail: - msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' - when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined - vars: - login_info: &login_info - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - -# Setup (clean environment) -- name: Service Profile Template absent - ucs_service_profile_template: &service_profile_template_absent - <<: *login_info - name: DEE-Ctrl - state: absent - - -# Test present (check_mode) -- name: Service Profile Template present (check_mode) - ucs_service_profile_template: &service_profile_template_present - <<: *login_info - name: DEE-Ctrl - template_type: updating-template - uuid_pool: UUID-Pool - storage_profile: DEE-StgProf - lan_connectivity_policy: Cntr-FC-Boot - iqn_pool: iSCSI-Boot-A - san_connectivity_policy: Cntr-FC-Boot - boot_policy: DEE-vMedia - maintenance_policy: default - server_pool: Container-Pool - host_firmware_package: 3.1.2b - bios_policy: Docker - check_mode: yes - register: cm_service_profile_template_present - - -# Present (normal mode) -- name: Service Profile Template present (normal mode) - ucs_service_profile_template: *service_profile_template_present - register: nm_service_profile_template_present - - -# Test present again (idempotent) -- name: Service Profile Template present again (check_mode) - ucs_service_profile_template: *service_profile_template_present - check_mode: yes - register: cm_service_profile_template_present_again - - -# Present again (normal mode) -- name: Service Profile Template present again (normal mode) - ucs_service_profile_template: *service_profile_template_present - register: nm_service_profile_template_present_again - - -# Verfiy present -- name: Verify Service Profile Template present results - assert: - that: - - cm_service_profile_template_present.changed == nm_service_profile_template_present.changed == true - - cm_service_profile_template_present_again.changed == nm_service_profile_template_present_again.changed == false - - -# Test change (check_mode) -- name: Service Profile Template change (check_mode) - ucs_service_profile_template: &service_profile_template_change - <<: *login_info - name: DEE-Ctrl - template_type: updating-template - uuid_pool: UUID-Pool - storage_profile: DEE-StgProf - lan_connectivity_policy: Cntr-FC-Boot - iqn_pool: iSCSI-Boot-B - san_connectivity_policy: Cntr-FC-Boot - boot_policy: DEE-vMedia - maintenance_policy: default - server_pool: Container-Pool - host_firmware_package: 3.1.2b - bios_policy: Docker - check_mode: yes - register: cm_service_profile_template_change - - -# Change (normal mode) -- name: Service Profile Template change (normal mode) - ucs_service_profile_template: *service_profile_template_change - register: nm_service_profile_template_change - - -# Test change again (idempotent) -- name: Service Profile Template again (check_mode) - ucs_service_profile_template: *service_profile_template_change - check_mode: yes - register: cm_service_profile_template_change_again - - -# Change again (normal mode) -- name: Service Profile Template change again (normal mode) - ucs_service_profile_template: *service_profile_template_change - register: nm_service_profile_template_change_again - - -# Verfiy change -- name: Verify Service Profile Template change results - assert: - that: - - cm_service_profile_template_change.changed == nm_service_profile_template_change.changed == true - - cm_service_profile_template_change_again.changed == nm_service_profile_template_change_again.changed == false - - -# Teardown (clean environment) -- name: Service Profile Template absent (check_mode) - ucs_service_profile_template: *service_profile_template_absent - check_mode: yes - register: cm_service_profile_template_absent - - -# Absent (normal mode) -- name: Service Profile Template absent (normal mode) - ucs_service_profile_template: *service_profile_template_absent - register: nm_service_profile_template_absent - - -# Test absent again (idempotent) -- name: Service Profile Template absent again (check_mode) - ucs_service_profile_template: *service_profile_template_absent - check_mode: yes - register: cm_service_profile_template_absent_again - - -# Absent again (normal mode) -- name: Service Profile Template absent again (normal mode) - ucs_service_profile_template: *service_profile_template_absent - register: nm_service_profile_template_absent_again - - -# Verfiy absent -- name: Verify Service Profile Template absent results - assert: - that: - - cm_service_profile_template_absent.changed == nm_service_profile_template_absent.changed == true - - cm_service_profile_template_absent_again.changed == nm_service_profile_template_absent_again.changed == false diff --git a/test/integration/targets/ucs_storage_profile/aliases b/test/integration/targets/ucs_storage_profile/aliases deleted file mode 100644 index 0689fba3e4a..00000000000 --- a/test/integration/targets/ucs_storage_profile/aliases +++ /dev/null @@ -1,7 +0,0 @@ -# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware. -# Example integration_config.yml: -# --- -# ucs_hostname: 172.16.143.136 -# ucs_username: admin -# ucs_password: password -unsupported diff --git a/test/integration/targets/ucs_storage_profile/tasks/main.yml b/test/integration/targets/ucs_storage_profile/tasks/main.yml deleted file mode 100644 index 7f576b85828..00000000000 --- a/test/integration/targets/ucs_storage_profile/tasks/main.yml +++ /dev/null @@ -1,138 +0,0 @@ -# Test code for the UCS modules -# Copyright 2018, David Soper (@dsoper2) - -- name: Test that we have a UCS host, UCS username, and UCS password - fail: - msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' - when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined - vars: - login_info: &login_info - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - -# Setup (clean environment) -- name: Storage Profile absent - ucs_storage_profile: &storage_profile_absent - <<: *login_info - name: DEE-StgProf - state: absent - - -# Test present (check_mode) -- name: Storage Profile present (check_mode) - ucs_storage_profile: &storage_profile_present - <<: *login_info - name: DEE-StgProf - local_luns: - - name: Boot-LUN - size: '60' - disk_policy_name: DEE-DG - - name: Data-LUN - size: '200' - disk_policy_name: DEE-DG - check_mode: yes - register: cm_storage_profile_present - - -# Present (normal mode) -- name: Storage Profile present (normal mode) - ucs_storage_profile: *storage_profile_present - register: nm_storage_profile_present - - -# Test present again (idempotent) -- name: Storage Profile present again (check_mode) - ucs_storage_profile: *storage_profile_present - check_mode: yes - register: cm_storage_profile_present_again - - -# Present again (normal mode) -- name: Storage Profile present again (normal mode) - ucs_storage_profile: *storage_profile_present - register: nm_storage_profile_present_again - - -# Verfiy present -- name: Verify Storage Profile present results - assert: - that: - - cm_storage_profile_present.changed == nm_storage_profile_present.changed == true - - cm_storage_profile_present_again.changed == nm_storage_profile_present_again.changed == false - - -# Test change (check_mode) -- name: Storage Profile change (check_mode) - ucs_storage_profile: &storage_profile_change - <<: *login_info - name: DEE-StgProf - local_luns: - - name: Boot-LUN - size: '60' - disk_policy_name: DEE-DG - - name: Data-LUN - state: absent - check_mode: yes - register: cm_storage_profile_change - - -# Change (normal mode) -- name: Storage Profile change (normal mode) - ucs_storage_profile: *storage_profile_change - register: nm_storage_profile_change - - -# Test change again (idempotent) -- name: Storage Profile again (check_mode) - ucs_storage_profile: *storage_profile_change - check_mode: yes - register: cm_storage_profile_change_again - - -# Change again (normal mode) -- name: Storage Profile change again (normal mode) - ucs_storage_profile: *storage_profile_change - register: nm_storage_profile_change_again - - -# Verfiy change -- name: Verify Storage Profile change results - assert: - that: - - cm_storage_profile_change.changed == nm_storage_profile_change.changed == true - - cm_storage_profile_change_again.changed == nm_storage_profile_change_again.changed == false - - -# Teardown (clean environment) -- name: Storage Profile absent (check_mode) - ucs_storage_profile: *storage_profile_absent - check_mode: yes - register: cm_storage_profile_absent - - -# Absent (normal mode) -- name: Storage Profile absent (normal mode) - ucs_storage_profile: *storage_profile_absent - register: nm_storage_profile_absent - - -# Test absent again (idempotent) -- name: Storage Profile absent again (check_mode) - ucs_storage_profile: *storage_profile_absent - check_mode: yes - register: cm_storage_profile_absent_again - - -# Absent again (normal mode) -- name: Storage Profile absent again (normal mode) - ucs_storage_profile: *storage_profile_absent - register: nm_storage_profile_absent_again - - -# Verfiy absent -- name: Verify Storage Profile absent results - assert: - that: - - cm_storage_profile_absent.changed == nm_storage_profile_absent.changed == true - - cm_storage_profile_absent_again.changed == nm_storage_profile_absent_again.changed == false diff --git a/test/integration/targets/ucs_timezone/aliases b/test/integration/targets/ucs_timezone/aliases deleted file mode 100644 index 16a714d47ac..00000000000 --- a/test/integration/targets/ucs_timezone/aliases +++ /dev/null @@ -1,7 +0,0 @@ -# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware. -# Example integration_config.yml: -# --- -# ucs_hostname: 172.22.251.170 -# ucs_username: admin -# ucs_password: password -unsupported \ No newline at end of file diff --git a/test/integration/targets/ucs_timezone/tasks/main.yml b/test/integration/targets/ucs_timezone/tasks/main.yml deleted file mode 100644 index c51aa202a54..00000000000 --- a/test/integration/targets/ucs_timezone/tasks/main.yml +++ /dev/null @@ -1,126 +0,0 @@ -# Test code for the UCS modules -# Copyright 2018, John McDonough (@movinalot) - -- name: Test that we have a UCS host, UCS username, and UCS password - fail: - msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' - when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined - vars: - login_info: &login_info - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - - -# Setup (clean environment) -- name: Timezone absent - ucs_timezone: &timezone_absent - <<: *login_info - state: absent - - -# Test present (check_mode) -- name: Timezone present (check_mode) - ucs_timezone: &timezone_present - <<: *login_info - timezone: America/Los_Angeles - description: Timezone for America/Los_Angeles - check_mode: yes - register: cm_timezone_present - - -# Present (normal mode) -- name: Timezone present (normal mode) - ucs_timezone: *timezone_present - register: nm_timezone_present - - -# Test present again (idempotent) -- name: Timezone present again (check_mode) - ucs_timezone: *timezone_present - check_mode: yes - register: cm_timezone_present_again - - -# Present again (normal mode) -- name: Timezone present again (normal mode) - ucs_timezone: *timezone_present - register: nm_timezone_present_again - - -# Verfiy present -- name: Verify Timezone present results - assert: - that: - - cm_timezone_present.changed == nm_timezone_present.changed == true - - cm_timezone_present_again.changed == nm_timezone_present_again.changed == false - - -# Test change (check_mode) -- name: Timezone description change (check_mode) - ucs_timezone: &timezone_change - <<: *timezone_present - descr: Testing Ansible - check_mode: yes - register: cm_timezone_descr_change - - -# Change (normal mode) -- name: Timezone description change (normal mode) - ucs_timezone: *timezone_change - register: nm_timezone_descr_change - - -# Test change again (idempotent) -- name: Timezone description again (check_mode) - ucs_timezone: *timezone_change - check_mode: yes - register: cm_timezone_descr_change_again - - -# Change again (normal mode) -- name: Timezone description change again (normal mode) - ucs_timezone: *timezone_change - register: nm_timezone_descr_change_again - - -# Verfiy change -- name: Verify Timezone change results - assert: - that: - - cm_timezone_descr_change.changed == nm_timezone_descr_change.changed == true - - cm_timezone_descr_change_again.changed == nm_timezone_descr_change_again.changed == false - - -# Teardown (clean environment) -- name: Timezone absent (check_mode) - ucs_timezone: *timezone_absent - check_mode: yes - register: cm_timezone_absent - - -# Absent (normal mode) -- name: Timezone absent (normal mode) - ucs_timezone: *timezone_absent - register: nm_timezone_absent - - -# Test absent again (idempotent) -- name: Timezone absent again (check_mode) - ucs_timezone: *timezone_absent - check_mode: yes - register: cm_timezone_absent_again - - -# Absent again (normal mode) -- name: Timezone absent again (normal mode) - ucs_timezone: *timezone_absent - register: nm_timezone_absent_again - - -# Verfiy absent -- name: Verify Timezone absent results - assert: - that: - - cm_timezone_absent.changed == nm_timezone_absent.changed == true - - cm_timezone_absent_again.changed == nm_timezone_absent_again.changed == false \ No newline at end of file diff --git a/test/integration/targets/ucs_uuid_pool/aliases b/test/integration/targets/ucs_uuid_pool/aliases deleted file mode 100644 index 0689fba3e4a..00000000000 --- a/test/integration/targets/ucs_uuid_pool/aliases +++ /dev/null @@ -1,7 +0,0 @@ -# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware. -# Example integration_config.yml: -# --- -# ucs_hostname: 172.16.143.136 -# ucs_username: admin -# ucs_password: password -unsupported diff --git a/test/integration/targets/ucs_uuid_pool/tasks/main.yml b/test/integration/targets/ucs_uuid_pool/tasks/main.yml deleted file mode 100644 index 2ce54c82b7f..00000000000 --- a/test/integration/targets/ucs_uuid_pool/tasks/main.yml +++ /dev/null @@ -1,128 +0,0 @@ -# Test code for the UCS modules -# Copyright 2018, David Soper (@dsoper2) - -- name: Test that we have a UCS host, UCS username, and UCS password - fail: - msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' - when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined - vars: - login_info: &login_info - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - -# Setup (clean environment) -- name: Server UUID Pools absent - ucs_uuid_pool: &uuid_pool_absent - <<: *login_info - name: UUID-Pool - state: absent - - -# Test present (check_mode) -- name: Server UUID Pools present (check_mode) - ucs_uuid_pool: &uuid_pool_present - <<: *login_info - name: UUID-Pool - order: sequential - first_uuid: 0000-000000000001 - last_uuid: 0000-000000000078 - check_mode: yes - register: cm_uuid_pool_present - - -# Present (normal mode) -- name: Server UUID Pools present (normal mode) - ucs_uuid_pool: *uuid_pool_present - register: nm_uuid_pool_present - - -# Test present again (idempotent) -- name: Server UUID Pools present again (check_mode) - ucs_uuid_pool: *uuid_pool_present - check_mode: yes - register: cm_uuid_pool_present_again - - -# Present again (normal mode) -- name: Server UUID Pools present again (normal mode) - ucs_uuid_pool: *uuid_pool_present - register: nm_uuid_pool_present_again - - -# Verfiy present -- name: Verify Server UUID Pools present results - assert: - that: - - cm_uuid_pool_present.changed == nm_uuid_pool_present.changed == true - - cm_uuid_pool_present_again.changed == nm_uuid_pool_present_again.changed == false - - -# Test change (check_mode) -- name: Server UUID Pools description change (check_mode) - ucs_uuid_pool: &uuid_pool_change - <<: *uuid_pool_present - descr: Testing Ansible - check_mode: yes - register: cm_uuid_pool_descr_change - - -# Change (normal mode) -- name: Server UUID Pools description change (normal mode) - ucs_uuid_pool: *uuid_pool_change - register: nm_uuid_pool_descr_change - - -# Test change again (idempotent) -- name: Server UUID Pools description again (check_mode) - ucs_uuid_pool: *uuid_pool_change - check_mode: yes - register: cm_uuid_pool_descr_change_again - - -# Change again (normal mode) -- name: Server UUID Pools description change again (normal mode) - ucs_uuid_pool: *uuid_pool_change - register: nm_uuid_pool_descr_change_again - - -# Verfiy change -- name: Verify Server UUID Pools change results - assert: - that: - - cm_uuid_pool_descr_change.changed == nm_uuid_pool_descr_change.changed == true - - cm_uuid_pool_descr_change_again.changed == nm_uuid_pool_descr_change_again.changed == false - - -# Teardown (clean environment) -- name: Server UUID Pools absent (check_mode) - ucs_uuid_pool: *uuid_pool_absent - check_mode: yes - register: cm_uuid_pool_absent - - -# Absent (normal mode) -- name: Server UUID Pools absent (normal mode) - ucs_uuid_pool: *uuid_pool_absent - register: nm_uuid_pool_absent - - -# Test absent again (idempotent) -- name: Server UUID Pools absent again (check_mode) - ucs_uuid_pool: *uuid_pool_absent - check_mode: yes - register: cm_uuid_pool_absent_again - - -# Absent again (normal mode) -- name: Server UUID Pools absent again (normal mode) - ucs_uuid_pool: *uuid_pool_absent - register: nm_uuid_pool_absent_again - - -# Verfiy absent -- name: Verify Server UUID Pools absent results - assert: - that: - - cm_uuid_pool_absent.changed == nm_uuid_pool_absent.changed == true - - cm_uuid_pool_absent_again.changed == nm_uuid_pool_absent_again.changed == false diff --git a/test/integration/targets/ucs_vhba_template/aliases b/test/integration/targets/ucs_vhba_template/aliases deleted file mode 100644 index 0689fba3e4a..00000000000 --- a/test/integration/targets/ucs_vhba_template/aliases +++ /dev/null @@ -1,7 +0,0 @@ -# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware. -# Example integration_config.yml: -# --- -# ucs_hostname: 172.16.143.136 -# ucs_username: admin -# ucs_password: password -unsupported diff --git a/test/integration/targets/ucs_vhba_template/tasks/main.yml b/test/integration/targets/ucs_vhba_template/tasks/main.yml deleted file mode 100644 index abf46ba68fc..00000000000 --- a/test/integration/targets/ucs_vhba_template/tasks/main.yml +++ /dev/null @@ -1,128 +0,0 @@ -# Test code for the UCS modules -# Copyright 2017, David Soper (@dsoper2) - -- name: Test that we have a UCS host, UCS username, and UCS password - fail: - msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' - when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined - - -# Setup (clean environment) -- name: vHBA templates absent - ucs_vhba_template: &vhba_templates_absent - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - name: vHBA-A - state: absent - - -# Test present (check_mode) -- name: vHBA templates present (check_mode) - ucs_vhba_template: &vhba_templates_present - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - name: vHBA-A - fabric: A - vsan: VSAN-A - wwpn_pool: WWPN-Pool-A - check_mode: yes - register: cm_vhba_templates_present - - -# Present (normal mode) -- name: vHBA templates present (normal mode) - ucs_vhba_template: *vhba_templates_present - register: nm_vhba_templates_present - - -# Test present again (idempotent) -- name: vHBA templates present again (check_mode) - ucs_vhba_template: *vhba_templates_present - check_mode: yes - register: cm_vhba_templates_present_again - - -# Present again (normal mode) -- name: vHBA templates present again (normal mode) - ucs_vhba_template: *vhba_templates_present - register: nm_vhba_templates_present_again - - -# Verfiy present -- name: Verify vHBA templates present results - assert: - that: - - cm_vhba_templates_present.changed == nm_vhba_templates_present.changed == true - - cm_vhba_templates_present_again.changed == nm_vhba_templates_present_again.changed == false - - -# Test change (check_mode) -- name: vHBA templates description change (check_mode) - ucs_vhba_template: &vhba_templates_change - <<: *vhba_templates_present - descr: Testing Ansible - check_mode: yes - register: cm_vhba_templates_descr_change - - -# Change (normal mode) -- name: vHBA templates description change (normal mode) - ucs_vhba_template: *vhba_templates_change - register: nm_vhba_templates_descr_change - - -# Test change again (idempotent) -- name: vHBA templates description again (check_mode) - ucs_vhba_template: *vhba_templates_change - check_mode: yes - register: cm_vhba_templates_descr_change_again - - -# Change again (normal mode) -- name: vHBA templates description change again (normal mode) - ucs_vhba_template: *vhba_templates_change - register: nm_vhba_templates_descr_change_again - - -# Verfiy change -- name: Verify vHBA templates change results - assert: - that: - - cm_vhba_templates_descr_change.changed == nm_vhba_templates_descr_change.changed == true - - cm_vhba_templates_descr_change_again.changed == nm_vhba_templates_descr_change_again.changed == false - - -# Teardown (clean environment) -- name: vHBA templates absent (check_mode) - ucs_vhba_template: *vhba_templates_absent - check_mode: yes - register: cm_vhba_templates_absent - - -# Absent (normal mode) -- name: vHBA templates absent (normal mode) - ucs_vhba_template: *vhba_templates_absent - register: nm_vhba_templates_absent - - -# Test absent again (idempotent) -- name: vHBA templates absent again (check_mode) - ucs_vhba_template: *vhba_templates_absent - check_mode: yes - register: cm_vhba_templates_absent_again - - -# Absent again (normal mode) -- name: vHBA templates absent again (normal mode) - ucs_vhba_template: *vhba_templates_absent - register: nm_vhba_templates_absent_again - - -# Verfiy absent -- name: Verify vHBA templates absent results - assert: - that: - - cm_vhba_templates_absent.changed == nm_vhba_templates_absent.changed == true - - cm_vhba_templates_absent_again.changed == nm_vhba_templates_absent_again.changed == false diff --git a/test/integration/targets/ucs_vlans/aliases b/test/integration/targets/ucs_vlans/aliases deleted file mode 100644 index 0689fba3e4a..00000000000 --- a/test/integration/targets/ucs_vlans/aliases +++ /dev/null @@ -1,7 +0,0 @@ -# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware. -# Example integration_config.yml: -# --- -# ucs_hostname: 172.16.143.136 -# ucs_username: admin -# ucs_password: password -unsupported diff --git a/test/integration/targets/ucs_vlans/tasks/main.yml b/test/integration/targets/ucs_vlans/tasks/main.yml deleted file mode 100644 index 0b6b5cb8423..00000000000 --- a/test/integration/targets/ucs_vlans/tasks/main.yml +++ /dev/null @@ -1,112 +0,0 @@ -# Test code for the UCS modules -# Copyright 2017, David Soper (@dsoper2) - -- name: Test that we have a UCS host, UCS username, and UCS password - fail: - msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' - when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined - vars: - login_info: &login_info - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - -# Setup (clean environment) -- name: VLANs absent - ucs_vlans: &vlans_absent - <<: *login_info - name: vlan2 - state: absent - -# Test present (check_mode) -- name: VLANs present (check_mode) - ucs_vlans: &vlans_present - <<: *login_info - name: vlan2 - id: '2' - native: 'yes' - check_mode: yes - register: cm_vlans_present - -# Present (normal mode) -- name: VLANs present (normal mode) - ucs_vlans: *vlans_present - register: nm_vlans_present - -# Test present again (idempotent) -- name: VLANs present again (check_mode) - ucs_vlans: *vlans_present - check_mode: yes - register: cm_vlans_present_again - -# Present again (normal mode) -- name: VLANs present again (normal mode) - ucs_vlans: *vlans_present - register: nm_vlans_present_again - -# Verfiy present -- name: Verify VLANs present results - assert: - that: - - cm_vlans_present.changed == nm_vlans_present.changed == true - - cm_vlans_present_again.changed == nm_vlans_present_again.changed == false - -# Test change (check_mode) -- name: VLANs VLAN change (check_mode) - ucs_vlans: &vlans_change - <<: *vlans_present - id: '20' - check_mode: yes - register: cm_vlans_vlan_change - -# Change (normal mode) -- name: VLANs VLAN change (normal mode) - ucs_vlans: *vlans_change - register: nm_vlans_vlan_change - -# Test change again (idempotent) -- name: VLANs VLAN change again (check_mode) - ucs_vlans: *vlans_change - check_mode: yes - register: cm_vlans_vlan_change_again - -# Change again (normal mode) -- name: VLANs VLAN change again (normal mode) - ucs_vlans: *vlans_change - register: nm_vlans_vlan_change_again - -# Verfiy change -- name: Verify VLANs change results - assert: - that: - - cm_vlans_vlan_change.changed == nm_vlans_vlan_change.changed == true - - cm_vlans_vlan_change_again.changed == nm_vlans_vlan_change_again.changed == false - -# Teardown (clean environment) -- name: VLANs absent (check_mode) - ucs_vlans: *vlans_absent - check_mode: yes - register: cm_vlans_absent - -# Absent (normal mode) -- name: VLANs absent (normal mode) - ucs_vlans: *vlans_absent - register: nm_vlans_absent - -# Test absent again (idempotent) -- name: VLANs absent again (check_mode) - ucs_vlans: *vlans_absent - check_mode: yes - register: cm_vlans_absent_again - -# Absent again (normal mode) -- name: VLANs absent again (normal mode) - ucs_vlans: *vlans_absent - register: nm_vlans_absent_again - -# Verfiy absent -- name: Verify VLANs absent results - assert: - that: - - cm_vlans_absent.changed == nm_vlans_absent.changed == true - - cm_vlans_absent_again.changed == nm_vlans_absent_again.changed == false diff --git a/test/integration/targets/ucs_vnic_template/aliases b/test/integration/targets/ucs_vnic_template/aliases deleted file mode 100644 index 0689fba3e4a..00000000000 --- a/test/integration/targets/ucs_vnic_template/aliases +++ /dev/null @@ -1,7 +0,0 @@ -# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware. -# Example integration_config.yml: -# --- -# ucs_hostname: 172.16.143.136 -# ucs_username: admin -# ucs_password: password -unsupported diff --git a/test/integration/targets/ucs_vnic_template/tasks/main.yml b/test/integration/targets/ucs_vnic_template/tasks/main.yml deleted file mode 100644 index 320f076dbda..00000000000 --- a/test/integration/targets/ucs_vnic_template/tasks/main.yml +++ /dev/null @@ -1,246 +0,0 @@ -# Test code for the UCS modules -# Copyright 2017, David Soper (@dsoper2) - -- name: Test that we have a UCS host, UCS username, and UCS password - fail: - msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' - when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined - vars: - login_info: &login_info - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - - -# Setup (clean environment) -- name: vNIC template absent - ucs_vnic_template: &vnic_templates_absent - <<: *login_info - name: vNIC-A-B - state: absent - -- name: vNIC primary template absent - ucs_vnic_template: &vnic_primary_templates_absent - <<: *login_info - name: vNIC-A - state: absent - -- name: vNIC secondary template absent - ucs_vnic_template: &vnic_secondary_templates_absent - <<: *login_info - name: vNIC-B - state: absent - - -# Test present (check_mode) -- name: vNIC template present (check_mode) - ucs_vnic_template: &vnic_templates_present - <<: *login_info - name: vNIC-A-B - fabric: A-B - vlans_list: - - name: default - native: 'yes' - - name: 10 - check_mode: yes - register: cm_vnic_templates_present - -- name: vNIC primary template present (check_mode) - ucs_vnic_template: &vnic_primary_templates_present - <<: *login_info - name: vNIC-A - fabric: A - redundancy_type: primary - peer_redundancy_templ: vNIC-B - template_type: updating-template - mtu: '9000' - mac_pool: MAC-Pool-A - network_control_policy: Enable-CDP-LLDP - vlans_list: - - name: default - native: 'yes' - - name: finance - check_mode: yes - register: cm_vnic_primary_templates_present - -- name: vNIC secondary template present (check_mode) - ucs_vnic_template: &vnic_secondary_templates_present - <<: *login_info - name: vNIC-B - fabric: B - redundancy_type: secondary - peer_redundancy_templ: vNIC-A - mac_pool: MAC-Pool-B - check_mode: yes - register: cm_vnic_secondary_templates_present - - -# Present (normal mode) -- name: vNIC template present (normal mode) - ucs_vnic_template: *vnic_templates_present - register: nm_vnic_templates_present - -- name: vNIC primary template present (normal mode) - ucs_vnic_template: *vnic_primary_templates_present - register: nm_vnic_primary_templates_present - -- name: vNIC secondary template present (normal mode) - ucs_vnic_template: *vnic_secondary_templates_present - register: nm_vnic_secondary_templates_present - - -# Test present again (idempotent) -- name: vNIC template present again (check_mode) - ucs_vnic_template: *vnic_templates_present - check_mode: yes - register: cm_vnic_templates_present_again - -- name: vNIC primary template present again (check_mode) - ucs_vnic_template: *vnic_primary_templates_present - check_mode: yes - register: cm_vnic_primary_templates_present_again - -- name: vNIC secondary template present again (check_mode) - ucs_vnic_template: *vnic_secondary_templates_present - check_mode: yes - register: cm_vnic_secondary_templates_present_again - - -# Present again (normal mode) -- name: vNIC template present again (normal mode) - ucs_vnic_template: *vnic_templates_present - register: nm_vnic_templates_present_again - -- name: vNIC primary template present again (normal mode) - ucs_vnic_template: *vnic_primary_templates_present - register: nm_vnic_primary_templates_present_again - -- name: vNIC secondary template present again (normal mode) - ucs_vnic_template: *vnic_secondary_templates_present - register: nm_vnic_secondary_templates_present_again - - -# Verfiy present -- name: Verify vNIC template present results - assert: - that: - - cm_vnic_templates_present.changed == nm_vnic_templates_present.changed == true - - cm_vnic_templates_present_again.changed == nm_vnic_templates_present_again.changed == false - - cm_vnic_primary_templates_present.changed == nm_vnic_primary_templates_present.changed == true - - cm_vnic_primary_templates_present_again.changed == nm_vnic_primary_templates_present_again.changed == false - - cm_vnic_secondary_templates_present.changed == nm_vnic_secondary_templates_present.changed == true - - cm_vnic_secondary_templates_present_again.changed == nm_vnic_secondary_templates_present_again.changed == false - - -# Test change (check_mode) -- name: vNIC template change (check_mode) - ucs_vnic_template: &vnic_templates_change - <<: *vnic_templates_present - vlans_list: - - name: default - native: 'yes' - - name: 10 - state: absent - check_mode: yes - register: cm_vnic_templates_change - - -# Change (normal mode) -- name: vNIC template change (normal mode) - ucs_vnic_template: *vnic_templates_change - register: nm_vnic_templates_change - - -# Test change again (idempotent) -- name: vNIC template change again (check_mode) - ucs_vnic_template: *vnic_templates_change - check_mode: yes - register: cm_vnic_templates_change_again - - -# Change again (normal mode) -- name: vNIC template change again (normal mode) - ucs_vnic_template: *vnic_templates_change - register: nm_vnic_templates_change_again - - -# Verfiy change -- name: Verify vNIC template change results - assert: - that: - - cm_vnic_templates_change.changed == nm_vnic_templates_change.changed == true - - cm_vnic_templates_change_again.changed == nm_vnic_templates_change_again.changed == false - - -# Teardown (clean environment) -- name: vNIC template absent (check_mode) - ucs_vnic_template: *vnic_templates_absent - check_mode: yes - register: cm_vnic_templates_absent - -- name: vNIC primary template absent (check_mode) - ucs_vnic_template: *vnic_primary_templates_absent - check_mode: yes - register: cm_vnic_primary_templates_absent - -- name: vNIC secondary template absent (check_mode) - ucs_vnic_template: *vnic_secondary_templates_absent - check_mode: yes - register: cm_vnic_secondary_templates_absent - - -# Absent (normal mode) -- name: vNIC template absent (normal mode) - ucs_vnic_template: *vnic_templates_absent - register: nm_vnic_templates_absent - -- name: vNIC primary template absent (normal mode) - ucs_vnic_template: *vnic_primary_templates_absent - register: nm_vnic_primary_templates_absent - -- name: vNIC secondary template absent (normal mode) - ucs_vnic_template: *vnic_secondary_templates_absent - register: nm_vnic_secondary_templates_absent - - -# Test absent again (idempotent) -- name: vNIC template absent again (check_mode) - ucs_vnic_template: *vnic_templates_absent - check_mode: yes - register: cm_vnic_templates_absent_again - -- name: vNIC primary template absent again (check_mode) - ucs_vnic_template: *vnic_primary_templates_absent - check_mode: yes - register: cm_vnic_primary_templates_absent_again - -- name: vNIC secondary template absent again (check_mode) - ucs_vnic_template: *vnic_secondary_templates_absent - check_mode: yes - register: cm_vnic_secondary_templates_absent_again - - -# Absent again (normal mode) -- name: vNIC template absent again (normal mode) - ucs_vnic_template: *vnic_templates_absent - register: nm_vnic_templates_absent_again - -- name: vNIC primary template absent again (normal mode) - ucs_vnic_template: *vnic_primary_templates_absent - register: nm_vnic_primary_templates_absent_again - -- name: vNIC secondary template absent again (normal mode) - ucs_vnic_template: *vnic_secondary_templates_absent - register: nm_vnic_secondary_templates_absent_again - - -# Verfiy absent -- name: Verify vNIC template absent results - assert: - that: - - cm_vnic_templates_absent.changed == nm_vnic_templates_absent.changed == true - - cm_vnic_templates_absent_again.changed == nm_vnic_templates_absent_again.changed == false - - cm_vnic_primary_templates_absent.changed == nm_vnic_primary_templates_absent.changed == true - - cm_vnic_primary_templates_absent_again.changed == nm_vnic_primary_templates_absent_again.changed == false - - cm_vnic_secondary_templates_absent.changed == nm_vnic_secondary_templates_absent.changed == true - - cm_vnic_secondary_templates_absent_again.changed == nm_vnic_secondary_templates_absent_again.changed == false diff --git a/test/integration/targets/ucs_vsans/aliases b/test/integration/targets/ucs_vsans/aliases deleted file mode 100644 index 0689fba3e4a..00000000000 --- a/test/integration/targets/ucs_vsans/aliases +++ /dev/null @@ -1,7 +0,0 @@ -# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware. -# Example integration_config.yml: -# --- -# ucs_hostname: 172.16.143.136 -# ucs_username: admin -# ucs_password: password -unsupported diff --git a/test/integration/targets/ucs_vsans/tasks/main.yml b/test/integration/targets/ucs_vsans/tasks/main.yml deleted file mode 100644 index a1469ca92cd..00000000000 --- a/test/integration/targets/ucs_vsans/tasks/main.yml +++ /dev/null @@ -1,127 +0,0 @@ -# Test code for the UCS modules -# Copyright 2017, David Soper (@dsoper2) - -- name: Test that we have a UCS host, UCS username, and UCS password - fail: - msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' - when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined - - -# Setup (clean environment) -- name: VSANs absent - ucs_vsans: &vsans_absent - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - name: vsan110 - state: absent - - -# Test present (check_mode) -- name: VSANs present (check_mode) - ucs_vsans: &vsans_present - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - name: vsan110 - vsan_id: '110' - vlan_id: '110' - check_mode: yes - register: cm_vsans_present - - -# Present (normal mode) -- name: VSANs present (normal mode) - ucs_vsans: *vsans_present - register: nm_vsans_present - - -# Test present again (idempotent) -- name: VSANs present again (check_mode) - ucs_vsans: *vsans_present - check_mode: yes - register: cm_vsans_present_again - - -# Present again (normal mode) -- name: VSANs present again (normal mode) - ucs_vsans: *vsans_present - register: nm_vsans_present_again - - -# Verfiy present -- name: Verify VSANs present results - assert: - that: - - cm_vsans_present.changed == nm_vsans_present.changed == true - - cm_vsans_present_again.changed == nm_vsans_present_again.changed == false - - -# Test change (check_mode) -- name: VSANs VLAN change (check_mode) - ucs_vsans: &vsans_change - <<: *vsans_present - vlan_id: '10' - check_mode: yes - register: cm_vsans_vlan_change - - -# Change (normal mode) -- name: VSANs VLAN change (normal mode) - ucs_vsans: *vsans_change - register: nm_vsans_vlan_change - - -# Test change again (idempotent) -- name: VSANs VLAN change again (check_mode) - ucs_vsans: *vsans_change - check_mode: yes - register: cm_vsans_vlan_change_again - - -# Change again (normal mode) -- name: VSANs VLAN change again (normal mode) - ucs_vsans: *vsans_change - register: nm_vsans_vlan_change_again - - -# Verfiy change -- name: Verify VSANs change results - assert: - that: - - cm_vsans_vlan_change.changed == nm_vsans_vlan_change.changed == true - - cm_vsans_vlan_change_again.changed == nm_vsans_vlan_change_again.changed == false - - -# Teardown (clean environment) -- name: VSANs absent (check_mode) - ucs_vsans: *vsans_absent - check_mode: yes - register: cm_vsans_absent - - -# Absent (normal mode) -- name: VSANs absent (normal mode) - ucs_vsans: *vsans_absent - register: nm_vsans_absent - - -# Test absent again (idempotent) -- name: VSANs absent again (check_mode) - ucs_vsans: *vsans_absent - check_mode: yes - register: cm_vsans_absent_again - - -# Absent again (normal mode) -- name: VSANs absent again (normal mode) - ucs_vsans: *vsans_absent - register: nm_vsans_absent_again - - -# Verfiy absent -- name: Verify VSANs absent results - assert: - that: - - cm_vsans_absent.changed == nm_vsans_absent.changed == true - - cm_vsans_absent_again.changed == nm_vsans_absent_again.changed == false diff --git a/test/integration/targets/ucs_wwn_pool/aliases b/test/integration/targets/ucs_wwn_pool/aliases deleted file mode 100644 index 0689fba3e4a..00000000000 --- a/test/integration/targets/ucs_wwn_pool/aliases +++ /dev/null @@ -1,7 +0,0 @@ -# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware. -# Example integration_config.yml: -# --- -# ucs_hostname: 172.16.143.136 -# ucs_username: admin -# ucs_password: password -unsupported diff --git a/test/integration/targets/ucs_wwn_pool/tasks/main.yml b/test/integration/targets/ucs_wwn_pool/tasks/main.yml deleted file mode 100644 index f380a3efe4b..00000000000 --- a/test/integration/targets/ucs_wwn_pool/tasks/main.yml +++ /dev/null @@ -1,129 +0,0 @@ -# Test code for the UCS modules -# Copyright 2017, David Soper (@dsoper2) - -- name: Test that we have a UCS host, UCS username, and UCS password - fail: - msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' - when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined - - -# Setup (clean environment) -- name: WWNN/WWPN Pools absent - ucs_wwn_pool: &wwn_pool_absent - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - name: WWPN-Pool-A - state: absent - - -# Test present (check_mode) -- name: WWNN/WWPN Pools present (check_mode) - ucs_wwn_pool: &wwn_pool_present - hostname: "{{ ucs_hostname }}" - username: "{{ ucs_username }}" - password: "{{ ucs_password }}" - name: WWPN-Pool-A - purpose: port - order: sequential - first_addr: 20:00:00:25:B5:48:0A:00 - last_addr: 20:00:00:25:B5:48:0A:0F - check_mode: yes - register: cm_wwn_pool_present - - -# Present (normal mode) -- name: WWNN/WWPN Pools present (normal mode) - ucs_wwn_pool: *wwn_pool_present - register: nm_wwn_pool_present - - -# Test present again (idempotent) -- name: WWNN/WWPN Pools present again (check_mode) - ucs_wwn_pool: *wwn_pool_present - check_mode: yes - register: cm_wwn_pool_present_again - - -# Present again (normal mode) -- name: WWNN/WWPN Pools present again (normal mode) - ucs_wwn_pool: *wwn_pool_present - register: nm_wwn_pool_present_again - - -# Verfiy present -- name: Verify WWNN/WWPN Pools present results - assert: - that: - - cm_wwn_pool_present.changed == nm_wwn_pool_present.changed == true - - cm_wwn_pool_present_again.changed == nm_wwn_pool_present_again.changed == false - - -# Test change (check_mode) -- name: WWNN/WWPN Pools description change (check_mode) - ucs_wwn_pool: &wwn_pool_change - <<: *wwn_pool_present - descr: Testing Ansible - check_mode: yes - register: cm_wwn_pool_descr_change - - -# Change (normal mode) -- name: WWNN/WWPN Pools description change (normal mode) - ucs_wwn_pool: *wwn_pool_change - register: nm_wwn_pool_descr_change - - -# Test change again (idempotent) -- name: WWNN/WWPN Pools description again (check_mode) - ucs_wwn_pool: *wwn_pool_change - check_mode: yes - register: cm_wwn_pool_descr_change_again - - -# Change again (normal mode) -- name: WWNN/WWPN Pools description change again (normal mode) - ucs_wwn_pool: *wwn_pool_change - register: nm_wwn_pool_descr_change_again - - -# Verfiy change -- name: Verify WWNN/WWPN Pools change results - assert: - that: - - cm_wwn_pool_descr_change.changed == nm_wwn_pool_descr_change.changed == true - - cm_wwn_pool_descr_change_again.changed == nm_wwn_pool_descr_change_again.changed == false - - -# Teardown (clean environment) -- name: WWNN/WWPN Pools absent (check_mode) - ucs_wwn_pool: *wwn_pool_absent - check_mode: yes - register: cm_wwn_pool_absent - - -# Absent (normal mode) -- name: WWNN/WWPN Pools absent (normal mode) - ucs_wwn_pool: *wwn_pool_absent - register: nm_wwn_pool_absent - - -# Test absent again (idempotent) -- name: WWNN/WWPN Pools absent again (check_mode) - ucs_wwn_pool: *wwn_pool_absent - check_mode: yes - register: cm_wwn_pool_absent_again - - -# Absent again (normal mode) -- name: WWNN/WWPN Pools absent again (normal mode) - ucs_wwn_pool: *wwn_pool_absent - register: nm_wwn_pool_absent_again - - -# Verfiy absent -- name: Verify WWNN/WWPN Pools absent results - assert: - that: - - cm_wwn_pool_absent.changed == nm_wwn_pool_absent.changed == true - - cm_wwn_pool_absent_again.changed == nm_wwn_pool_absent_again.changed == false diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt index 2ff18a9d6af..6064efe478a 100644 --- a/test/sanity/ignore.txt +++ b/test/sanity/ignore.txt @@ -121,8 +121,6 @@ lib/ansible/module_utils/powershell/Ansible.ModuleUtils.LinkUtil.psm1 pslint:PSU lib/ansible/module_utils/pycompat24.py future-import-boilerplate lib/ansible/module_utils/pycompat24.py metaclass-boilerplate lib/ansible/module_utils/pycompat24.py no-get-exception -lib/ansible/module_utils/remote_management/ucs.py future-import-boilerplate -lib/ansible/module_utils/remote_management/ucs.py metaclass-boilerplate lib/ansible/module_utils/service.py future-import-boilerplate lib/ansible/module_utils/service.py metaclass-boilerplate lib/ansible/module_utils/six/__init__.py empty-init # breaks namespacing, bundled, do not override @@ -2118,52 +2116,6 @@ lib/ansible/modules/remote_management/cpm/cpm_serial_port_info.py validate-modul lib/ansible/modules/remote_management/cpm/cpm_serial_port_info.py validate-modules:parameter-type-not-in-doc lib/ansible/modules/remote_management/cpm/cpm_user.py validate-modules:doc-missing-type lib/ansible/modules/remote_management/cpm/cpm_user.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/remote_management/ucs/ucs_disk_group_policy.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/remote_management/ucs/ucs_disk_group_policy.py validate-modules:doc-default-does-not-match-spec -lib/ansible/modules/remote_management/ucs/ucs_disk_group_policy.py validate-modules:doc-elements-mismatch -lib/ansible/modules/remote_management/ucs/ucs_disk_group_policy.py validate-modules:doc-required-mismatch -lib/ansible/modules/remote_management/ucs/ucs_disk_group_policy.py validate-modules:nonexistent-parameter-documented -lib/ansible/modules/remote_management/ucs/ucs_disk_group_policy.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/remote_management/ucs/ucs_ip_pool.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/remote_management/ucs/ucs_lan_connectivity.py validate-modules:doc-elements-mismatch -lib/ansible/modules/remote_management/ucs/ucs_lan_connectivity.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/remote_management/ucs/ucs_mac_pool.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/remote_management/ucs/ucs_managed_objects.py validate-modules:doc-elements-mismatch -lib/ansible/modules/remote_management/ucs/ucs_managed_objects.py validate-modules:parameter-list-no-elements -lib/ansible/modules/remote_management/ucs/ucs_managed_objects.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/remote_management/ucs/ucs_managed_objects.py validate-modules:undocumented-parameter -lib/ansible/modules/remote_management/ucs/ucs_ntp_server.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/remote_management/ucs/ucs_san_connectivity.py validate-modules:doc-required-mismatch -lib/ansible/modules/remote_management/ucs/ucs_san_connectivity.py validate-modules:nonexistent-parameter-documented -lib/ansible/modules/remote_management/ucs/ucs_san_connectivity.py validate-modules:parameter-list-no-elements -lib/ansible/modules/remote_management/ucs/ucs_san_connectivity.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/remote_management/ucs/ucs_san_connectivity.py validate-modules:undocumented-parameter -lib/ansible/modules/remote_management/ucs/ucs_service_profile_template.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/remote_management/ucs/ucs_storage_profile.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/remote_management/ucs/ucs_storage_profile.py validate-modules:doc-elements-mismatch -lib/ansible/modules/remote_management/ucs/ucs_storage_profile.py validate-modules:doc-type-does-not-match-spec -lib/ansible/modules/remote_management/ucs/ucs_storage_profile.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/remote_management/ucs/ucs_timezone.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/remote_management/ucs/ucs_uuid_pool.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/remote_management/ucs/ucs_vhba_template.py validate-modules:doc-required-mismatch -lib/ansible/modules/remote_management/ucs/ucs_vhba_template.py validate-modules:nonexistent-parameter-documented -lib/ansible/modules/remote_management/ucs/ucs_vhba_template.py validate-modules:parameter-list-no-elements -lib/ansible/modules/remote_management/ucs/ucs_vhba_template.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/remote_management/ucs/ucs_vhba_template.py validate-modules:undocumented-parameter -lib/ansible/modules/remote_management/ucs/ucs_vlans.py validate-modules:doc-required-mismatch -lib/ansible/modules/remote_management/ucs/ucs_vlans.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/remote_management/ucs/ucs_vnic_template.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/remote_management/ucs/ucs_vnic_template.py validate-modules:parameter-list-no-elements -lib/ansible/modules/remote_management/ucs/ucs_vnic_template.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/remote_management/ucs/ucs_vsans.py validate-modules:doc-required-mismatch -lib/ansible/modules/remote_management/ucs/ucs_vsans.py validate-modules:parameter-list-no-elements -lib/ansible/modules/remote_management/ucs/ucs_vsans.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/remote_management/ucs/ucs_vsans.py validate-modules:undocumented-parameter -lib/ansible/modules/remote_management/ucs/ucs_wwn_pool.py validate-modules:doc-required-mismatch -lib/ansible/modules/remote_management/ucs/ucs_wwn_pool.py validate-modules:nonexistent-parameter-documented -lib/ansible/modules/remote_management/ucs/ucs_wwn_pool.py validate-modules:parameter-list-no-elements -lib/ansible/modules/remote_management/ucs/ucs_wwn_pool.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/remote_management/ucs/ucs_wwn_pool.py validate-modules:undocumented-parameter lib/ansible/modules/source_control/git.py pylint:blacklisted-name lib/ansible/modules/source_control/git.py use-argspec-type-path lib/ansible/modules/source_control/git.py validate-modules:doc-missing-type @@ -2349,8 +2301,6 @@ lib/ansible/plugins/doc_fragments/skydive.py future-import-boilerplate lib/ansible/plugins/doc_fragments/skydive.py metaclass-boilerplate lib/ansible/plugins/doc_fragments/tower.py future-import-boilerplate lib/ansible/plugins/doc_fragments/tower.py metaclass-boilerplate -lib/ansible/plugins/doc_fragments/ucs.py future-import-boilerplate -lib/ansible/plugins/doc_fragments/ucs.py metaclass-boilerplate lib/ansible/plugins/doc_fragments/url.py future-import-boilerplate lib/ansible/plugins/doc_fragments/url.py metaclass-boilerplate lib/ansible/plugins/doc_fragments/validate.py future-import-boilerplate