ansible/docs/docsite/rst/dev_guide/developing_module_utilities.rst
Bojan Vitnik b0cc240665 New module: xenserver_guest - manages XenServer VMs (#41041)
* XenServer related modules - initial commit

 - New module_util: xenserver. Contains common module arguments, functions
   and classes useful for future XenServer related modules.
 - New module_docs_fragment: xenserver. Describes common module arguments.
 - New module: xenserver_guest. Supports VM deployment, reconfiguration,
   removal, detection of changes, state management, fact gathering and
   Ansible check mode. Module is fully documented.
 - Updated: developing_module_utilities.rst.
 - Module params, workflow and some functions are based on or taken from
   vmware_guest module.

* Implemented support for configuring custom VM params in xenserver_guest module

* Compatibility fixes and documentation update

 - xenserver module_util: implemented support for XenAPI.py version older
   than 7.2.
 - xenserver module_util: PEP8 fixes.
 - xenserver module_util: Added missing imports.
 - xenserver module_util: Copyright notice fixes.
 - xenserver_guest module: updated module documentation with notes regarding
   module requirements and compatibility.
 - xenserver_guest module: bumped version_added to 2.7.
 - xenserver_guest module: minor fixes.

* VM power state management refactoring, subargument specs in xenserver_guest module, other fixes

 - VM power state management code moved from xenserver_guest module to xenserver
   module_util (set_vm_power_state function).
 - Code for waiting for VM IP address moved from xenserver_guest module to
   xenserver module_util (wait_for_vm_ip_address function).
 - xenserver module_util: implemented get_object_ref function to clean up
   a lot of repeated code in xenserver_guest module.
 - xenserver module_util: added additional aliases 'host' and 'pool' for
   'hostname' common module argument. They are more in line with what
   XenServer users are familiar with.
 - xenserver module_util: minor fixes.
 - xenserver_guest module: removed VM state management other than 'present',
   'absent' and 'poweredon'. Other states are to be managed by separate module.
 - xenserver_guest module: added subargument specs and cleaned up custom code
   for subargument validation.
 - xenserver_guest module: reorganized code for disk and network reconfiguation
   to minimize code duplication.
 - xenserver_guest module: renamed 'cdrom.iso' module argument to
   'cdrom.iso_name', avoids cryptic error message when parameter is
   missing.
 - xenserver_guest module: documentation update.
 - xenserver_guest module: changes in error messages.
 - xenserver_guest module: minor fixes.

* Implemented guest OS network parameter configuration and other

 - xenserver module_util: moved code for validating MAC addresses from
   xenserver_guest module and implemented a range of functions for validating
   IP addresses and related entities and converting prefixes to netmasks and
   vice versa.
 - xenserver module_util: updated fact gathering code to support guest OS
   network parameters.
 - xenserver module_util: added docstrings.
 - xenserver module_util: minor changes.
 - xenserver_guest module: implemented support for guest OS network parameter
   configuration.
 - xenserver_guest module: changed CD-ROM handling code.
 - xenserver_guest module: changed so that user friendly version of changes
   list is always returned in module result.
 - xenserver_guest module: error message changes.
 - xenserver_guest module: added docstrings.
 - xenserver_guest module: documentation update.
 - xenserver_guest module: minor changes and fixes.

* Various fixes and code cleanup

 - xenserver module_util: implemented get_xenserver_version function.
 - xenserver module_util: moved customization agent detection code to
   gather_vm_params function. customization_agent variable is now part of
   vm_params. An exception in customization agent detection code that prevented
   deployment of new VMs is also fixed.
 - xenserver module_util: added support for alternative VM state names with
   dash and underscore in set_power_state function.
 - xenserver_guest module: removed customization agent detection code
   as it is now implemented in xenserver module_util.
 - xenserver_guest module: fixed a bug in xenserver_data update code that
   occured when "networks.mac" was not specified in module params and
   other fixes.
 - xenserver_guest module: some code cleanup.
 - xenserver_guest module: bumped version_added to 2.8.
2018-11-19 01:50:20 -05:00

81 lines
6.7 KiB
ReStructuredText

.. _appendix_module_utilities:
**************************
Appendix: Module Utilities
**************************
Ansible provides a number of module utilities that provide helper functions that you can use when developing your own modules. The ``basic.py`` module utility provides the main entry point for accessing the Ansible library, and all Python Ansible modules must, at minimum, import ``AnsibleModule``::
from ansible.module_utils.basic import AnsibleModule
The following is a list of ``module_utils`` files and a general description. The module utility source code lives in the ``./lib/ansible/module_utils`` directory under your main Ansible path - for more details on any specific module utility, please see the source code.
.. include:: shared_snippets/licensing.txt
- alicloud_ecs.py - Definitions and utilities for modules working with Alibaba Cloud ECS.
- api.py - Adds shared support for generic API modules.
- azure_rm_common.py - Definitions and utilities for Microsoft Azure Resource Manager template deployments.
- basic.py - General definitions and helper utilities for Ansible modules.
- cloudstack.py - Utilities for CloudStack modules.
- database.py - Miscellaneous helper functions for PostGRES and MySQL
- docker_common.py - Definitions and helper utilities for modules working with Docker.
- ec2.py - Definitions and utilities for modules working with Amazon EC2
- facts/- Folder containing helper functions for modules that return facts. See https://github.com/ansible/ansible/pull/23012 for more information.
- gce.py - Definitions and helper functions for modules that work with Google Compute Engine resources.
- ismount.py - Contains single helper function that fixes os.path.ismount
- keycloak.py - Definitions and helper functions for modules working with the Keycloak API
- known_hosts.py - utilities for working with known_hosts file
- manageiq.py - Functions and utilities for modules that work with ManageIQ platform and its resources.
- memset.py - Helper functions and utilities for interacting with Memset's API.
- mysql.py - Allows modules to connect to a MySQL instance
- netapp.py - Functions and utilities for modules that work with the NetApp storage platforms.
- network/a10/a10.py - Utilities used by the a10_server module to manage A10 Networks devices.
- network/aci/aci.py - Definitions and helper functions for modules that manage Cisco ACI Fabrics.
- network/aireos/aireos.py - Definitions and helper functions for modules that manage Cisco WLC devices.
- network/aos/aos.py - Module support utilities for managing Apstra AOS Server.
- network/aruba/aruba.py - Helper functions for modules working with Aruba networking devices.
- network/asa/asa.py - Module support utilities for managing Cisco ASA network devices.
- network/avi/avi.py - Helper functions for modules working with AVI networking devices.
- network/bigswitch/bigswitch_utils.py - Utilities used by the bigswitch module to manage Big Switch Networks devices.
- network/cloudengine/ce.py - Module support utilities for managing Huawei Cloudengine switch.
- network/cnos/cnos.py - Helper functions for modules working on devices running Lenovo CNOS.
- network/common/config.py - Configuration utility functions for use by networking modules
- network/common/netconf.py - Definitions and helper functions for modules that use Netconf transport.
- network/common/parsing.py - Definitions and helper functions for Network modules.
- network/common/network.py - Functions for running commands on networking devices
- network/common/utils.py - Defines commands and comparison operators and other utilises for use in networking modules
- network/dellos6/dellos6.py - Module support utilities for managing device running Dell OS6.
- network/dellos9/dellos9.py - Module support utilities for managing device running Dell OS9.
- network/dellos10/dellos10.py - Module support utilities for managing device running Dell OS10.
- network/enos/enos.py - Helper functions for modules working with Lenovo ENOS devices.
- network/eos/eos.py - Helper functions for modules working with EOS networking devices.
- network/fortios/fortios.py - Module support utilities for managing FortiOS devices.
- network/ios/ios.py - Definitions and helper functions for modules that manage Cisco IOS networking devices
- network/iosxr/iosxr.py - Definitions and helper functions for modules that manage Cisco IOS-XR networking devices.
- network/ironware/ironware.py - Module support utilities for managing Brocade IronWare devices.
- network/junos/junos.py - Definitions and helper functions for modules that manage Junos networking devices.
- network/meraki/meraki.py - Utilities specifically for the Meraki network modules.
- network/netscaler/netscaler.py - Utilities specifically for the netscaler network modules.
- network/nso/nso.py - Utilities for modules that work with Cisco NSO.
- network/nxos/nxos.py - Contains definitions and helper functions specific to Cisco NXOS networking devices.
- network/onyx/onyx.py - Definitions and helper functions for modules that manage Mellanox ONYX networking devices.
- network/ordance/ordance.py - Module support utilities for managing Ordnance devices.
- network/sros/sros.py - Helper functions for modules working with Open vSwitch bridges.
- network/vyos/vyos.py - Definitions and functions for working with VyOS networking
- openstack.py - Utilities for modules that work with Openstack instances.
- openswitch.py - Definitions and helper functions for modules that manage OpenSwitch devices
- powershell.ps1 - Utilities for working with Microsoft Windows clients
- pure.py - Functions and utilities for modules that work with the Pure Storage storage platforms.
- pycompat24.py - Exception workaround for Python 2.4.
- rax.py - Definitions and helper functions for modules that work with Rackspace resources.
- redhat.py - Functions for modules that manage Red Hat Network registration and subscriptions
- service.py - Contains utilities to enable modules to work with Linux services (placeholder, not in use).
- shell.py - Functions to allow modules to create shells and work with shell commands
- six/__init__.py - Bundled copy of the `Six Python library <https://pythonhosted.org/six/>`_ to aid in writing code compatible with both Python 2 and Python 3.
- splitter.py - String splitting and manipulation utilities for working with Jinja2 templates
- urls.py - Utilities for working with http and https requests
- utm_utils.py - Contains base class for creating new Sophos UTM Modules and helper functions for handling the rest interface of Sophos UTM
- vca.py - Contains utilities for modules that work with VMware vCloud Air
- vmware.py - Contains utilities for modules that work with VMware vSphere VMs
- xenserver.py - Contains utilities for modules that work with XenServer.