* Add ArgumentSpecValidator to docs * Improve docs for ArgumentSpecValidator * Document removal of private methods * Update module_utils documentation - Add docs for argument spec classes as well as validation and parameters files. - preserve the order in the source for errors.py - document DEFAULT_TYPE_VALIDATORS so it can be referenced elsewhere - fix automodule directive for validation.py * Update docs in arg_spec and paremeters - This improves the generated documentation. * Document breaking changes in porting guide. * Update formatting in porting guide and add a Deprecated section * Fine tune module_utils documentation * Move instance docstring to the __init__ method Remove optional description since it fails the sanity test and I am not 100% it is valid anyway. * Remoe incorrect parameter from docstring This was changed a while ago but wasn't removed from the docstring. * Use attr rather than attribute The py:attribute: domain only exists in newer Sphinx >= 3.1. * Improve documentation on exceptions * Final pass - use args/kwargs instead of param - fix formatting errors that didn't display examples correctly - format TypeErrors so they are referenced as classes - specify complex types
1.7 KiB
Ansible Reference: Module Utilities
This page documents utilities intended to be helpful when writing Ansible modules in Python.
AnsibleModule
To use this functionality, include
from ansible.module_utils.basic import AnsibleModule
in
your module.
ansible.module_utils.basic.AnsibleModule
Basic
To use this functionality, include
import ansible.module_utils.basic
in your module.
ansible.module_utils.basic
Argument Spec
Classes and functions for validating parameters against an argument spec.
ArgumentSpecValidator
ansible.module_utils.common.arg_spec.ArgumentSpecValidator
ValidationResult
ansible.module_utils.common.arg_spec.ValidationResult
Parameters
ansible.module_utils.common.parameters
dict
of type names, such as'str'
, and the default function used to check that type,~ansible.module_utils.common.validation.check_type_str
in this case.
Validation
Standalone functions for validating various parameter types.
ansible.module_utils.common.validation
Errors
ansible.module_utils.errors