cli.create.inventory package¶
Submodules¶
cli.create.inventory.cli module¶
- cli.create.inventory.cli.main(argv: List[str] | None = None) int¶
cli.create.inventory.credentials_generator module¶
cli.create.inventory.filters module¶
- cli.create.inventory.filters.filter_dynamic_inventory(dyn_inv: Dict[str, Any], include_filter: Set[str] | None, exclude_filter: Set[str] | None, legacy_roles_filter: Set[str] | None) Dict[str, Any]¶
- Apply include/exclude/legacy role filters in the same order as before:
include -> exclude -> legacy roles
- cli.create.inventory.filters.parse_roles_list(raw_roles: list[str] | None) Set[str] | None¶
- Parse a list of IDs supplied on the CLI. Supports:
–include web-app-nextcloud web-app-mastodon –include web-app-nextcloud,web-app-mastodon
Same logic is reused for –exclude and –roles.
cli.create.inventory.host_vars module¶
- cli.create.inventory.host_vars.apply_vars_overrides_from_file(host_vars_file: Path, vars_file: Path) None¶
cli.create.inventory.inventory_generator module¶
- cli.create.inventory.inventory_generator.generate_dynamic_inventory(host: str, roles_dir: Path, categories_file: Path, tmp_inventory: Path, project_root: Path, env: Dict[str, str] | None) Dict[str, Any]¶
- Generate a dynamic inventory by executing the generator as a module:
python -m cli.build.inventory.full …
This avoids fragile file path construction and fixes ‘cli/cli/…’ issues.
cli.create.inventory.passwords module¶
- cli.create.inventory.passwords.generate_random_password(length: int = 64) str¶
cli.create.inventory.project module¶
- cli.create.inventory.project.build_env_with_project_root(project_root: Path) Dict[str, str]¶
Return an environment dict where PYTHONPATH includes the project root. This makes module_utils and other top-level packages importable in subprocesses.
- cli.create.inventory.project.detect_project_root(start_file: Path) Path¶
Detect repo root by walking upwards from a file path until we find a typical repo layout.
- We require:
cli/ directory
roles/ directory
group_vars/ directory
This avoids brittle parents[N] assumptions and fixes “cli/cli/…” path bugs.
cli.create.inventory.role_resolver module¶
- cli.create.inventory.role_resolver.resolve_role_path(application_id: str, roles_dir: Path, project_root: Path, env: Dict[str, str] | None) Path | None¶
- Resolve role path by calling:
python -m cli.meta.applications.role_name <app_id> -r <roles_dir>
- The helper may print:
bare folder name (e.g. web-app-nextcloud)
relative path (e.g. roles/web-app-nextcloud)
absolute path
cli.create.inventory.subprocess_runner module¶
- cli.create.inventory.subprocess_runner.run_subprocess(cmd: List[str], capture_output: bool = False, env: Dict[str, str] | None = None) CompletedProcess¶
Run a subprocess command and either stream output or capture it. Raise SystemExit on non-zero return code.
cli.create.inventory.yaml_io module¶
Module contents¶
- cli.create.inventory.main(argv: List[str] | None = None) int¶