Files
computer-playbook/module_utils
Kevin Veen-Birkenbach ec284cc765 fix(lint): resolve Ruff E701/E702 and exclude build artifacts
- Fix E701 by expanding single-line class and loop statements into blocks
- Fix E702 by splitting semicolon-separated statements
- Exclude build/, dist/, venv, and egg-info from Ruff linting
- Apply fixes consistently to source and generated files

No runtime behavior changes; lint-only cleanup to stabilize CI.

https://chatgpt.com/share/6942c9e3-80fc-800f-b471-5e1ee567f8fe
2025-12-17 16:18:53 +01:00
..
2025-07-17 16:38:20 +02:00
2025-04-29 05:16:55 +02:00
2025-12-17 12:56:47 +01:00
2025-07-17 16:38:20 +02:00
2025-12-17 12:56:47 +01:00

Shared Utility Code (module_utils/) for Infinito.Nexus

This directory contains shared Python utility code (also known as "library code") for use by custom Ansible modules, plugins, or roles in the Infinito.Nexus project.

When to Use module_utils

  • Shared logic: Use module_utils to define functions, classes, or helpers that are shared across multiple custom modules, plugins, or filter/lookups in your project.
  • Reduce duplication: Centralize code such as API clients, input validation, complex calculations, or protocol helpers.
  • Maintainability: If you find yourself repeating code in different custom modules/plugins, refactor it into module_utils/.

Examples

  • Shared HTTP(S) connection handler for multiple modules.
  • Common validation or transformation functions for user input.
  • Utility functions for interacting with Docker, LDAP, etc.

Usage Example

In a custom Ansible module or plugin:

from ansible.module_utils.infinito_utils import my_shared_function

When not to Use module_utils

  • Do not place standalone Ansible modules or plugins here—those go into library/, filter_plugins/, or lookup_plugins/ respectively.
  • Only use for code that will be imported by other plugins or modules.

Further Reading