Files
computer-playbook/library
kevinveenbirkenbachandClaude Opus 5.5 73a16bef09 perf(sys-svc-compose): prepare the compose instance in one module call
Every app's compose pass ran three remote tasks before compose up: create the directories, compose ps for running containers, and stat the pending marker (53 apps x ~2.7 s in a production run). compose_instance_prepare does all three in one call from 02_stack_host_prep.yml, sharing the directory creation with directory_batch through utils/directory_batch.py; compose ps runs only in compose mode. up.yml evaluates the registered result, named compose_instance_before_files because it predates 04_files: the running check is skipped whenever the compose, env or override file changed in this run (those changes notify compose-up themselves).

Replay harness old vs new: rendered files and the compose-up, marker and swarm handlers identical in every scenario; the only difference is the skipped running check when only the override changed, where compose-up still runs. About 85 s per full production run.

Merge note: store-i18n's a4c7fda974 hoists the removed marker stat into a block; resolve up.yml with this side.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-25 21:22:32 +01:00
..
…

Custom Modules (library/)

This directory contains project-specific Ansible modules used by Infinito.Nexus.

What Belongs Here

Use library/ for idempotent module logic that represents concrete automation actions.

Typical cases:

  • managing resources that have no suitable built-in/community module,
  • wrapping internal APIs or internal infrastructure semantics,
  • implementing reusable module interfaces for role/playbook consumption.

What Does Not Belong Here

  • Shared helper code used by multiple modules/plugins goes to utils/.
  • Jinja transformations belong to plugins/filter/.
  • Runtime value retrieval belongs to plugins/lookup/.
  • Task execution wrappers belong to plugins/action/.

Usage

Ansible searches library/ for custom modules. In playbooks, call them like built-in modules.

- name: Run a custom Infinito module
  infinito_custom_module:
    option_one: value
    option_two: value

Implementation Notes

  • Keep modules idempotent and predictable.
  • Validate input early and return structured failure messages.
  • Move duplicated helpers into utils/.

Shebang Requirement for Custom Modules

Files in library/ should use:

#!/usr/bin/python

Ansible rewrites this interpreter path to the configured host interpreter for module execution.

References