Commit Graph

3046 Commits

Author SHA1 Message Date
27c399123b Optimized handler loading. Requirerd due to 2.18->2.20 update 2025-12-04 00:53:27 +01:00
7b262cf46e Further app load optiomation due to 2.18->2.20 update 2025-12-03 23:05:35 +01:00
8fad77f17f Solved CDN and Logout deployment bugs existing due to 2.18->2.20 update 2025-12-03 22:45:48 +01:00
91d5ba35d1 Add container-aware execution logic and CI stability fixes
- Introduce global IS_CONTAINER flag based on ansible_virtualization facts
- Skip systemd-based handlers and tasks when running inside containers
- Extend EXCLUDED_ROLES list in GitHub Actions test-deploy workflow
- Ensure docker.sock is mounted for all CI deploy stages
- Improve sys-svc-docker by suppressing service restarts inside containers
- Add meta: flush_handlers to properly trigger delayed docker restarts
- Update sys-service handlers with container guards
- Update sys-timer tasks to avoid systemctl inside CI containers
- Enhance drv-non-free role with Manjaro detection and mhwd fallback warning
- Skip swapfile generation in containers
- Minor service template fixes and cleanup in proxy.conf.j2

Details and discussion: https://chatgpt.com/share/6930a4ca-56f4-800f-9b3d-4791f040a03b
2025-12-03 22:00:18 +01:00
84d3c8fc16 Optimized ignoring of LID driver 2025-12-03 20:07:02 +01:00
9182d14175 Ignored LID Switch Driver 2025-12-03 19:43:29 +01:00
b914fb9789 Refactor CLI filters: rename --ignore to --exclude and update all related logic and tests
- Updated CLI argument parsing to use --exclude instead of --ignore.
- Adjusted help texts, comments, and error messages accordingly.
- Updated role filtering logic and references (include → exclude).
- Added new unit tests for parse_roles_list(), filter_inventory_by_include(), and filter_inventory_by_ignore().
- Improved wording and consistency in docstrings.

This change is part of the refactoring required for the Ansible 2.18 → 2.20 upgrade, ensuring naming clarity and avoiding confusion with Python's 'ignore' semantics.

Conversation reference: https://chatgpt.com/share/69307ef2-1fb4-800f-a2ec-d56020019269
2025-12-03 19:18:39 +01:00
298ba80664 Added explicit variable names 2025-12-03 19:13:06 +01:00
c5e294e567 Made MariaDB local network public 2025-12-03 18:48:52 +01:00
40c40e2000 Minor performance optimations 2025-12-03 18:21:10 +01:00
031775c096 Removed redundancies and simplified run_once flag 2025-12-03 18:12:09 +01:00
9ecfd8a762 Added shallow to Dockerfile 2025-12-03 18:01:08 +01:00
379b1d420e Refactor MariaDB and PostgreSQL roles for Ansible 2.20 compatibility and Infinito.Nexus conventions
- Replace legacy docker_container-based MariaDB deployment with docker-compose based workflow
- Add custom Dockerfile and docker-compose templates for MariaDB
- Split MariaDB command into separate arguments to avoid entrypoint parsing errors
- Introduce MARIADB_CUSTOM_IMAGE and MARIADB_EXPOSE_LOCAL variables
- Add docker_compose_flush_handlers to ensure correct handler execution on first run
- Replace utils/once/finalize.yml with utils/once/flag.yml for new run-once semantics
- Align variable naming with Infinito.Nexus UPPERCASE conventions
- Fix PostgreSQL custom image variable name (POSTGRES_CUSTOM_IMAGE_NAME → POSTGRES_CUSTOM_IMAGE)
- Remove obsolete flush_handlers var injection in svc-db-postgres/tasks/main.yml
- General cleanup after migration from Ansible 2.18 → 2.20

Conversation reference:
https://chatgpt.com/share/69306c81-9934-800f-b317-f53a8f246a73
2025-12-03 18:00:30 +01:00
13d47766b7 Upercased MariaDB variables 2025-12-03 14:29:43 +01:00
1d0f26617a Optimized docker_git_repository_ variables 2025-12-03 14:23:53 +01:00
6f676462ea Solved escaping issue - https://chatgpt.com/share/69303513-df24-800f-994c-42c10c465b47 2025-12-03 14:03:33 +01:00
794bd4487a Changed from pacman to yay install 2025-12-03 13:27:30 +01:00
3e02fc0190 Added Exception 2025-12-03 13:27:05 +01:00
4a4c3c741c dev-yay: override Python interpreter for core tasks to ensure AUR builder compatibility
This change sets ansible_python_interpreter to /usr/bin/python3 when including
01_core.yml. It avoids permission issues when Ansible runs module-based tasks
as the non-privileged AUR builder user, since the virtualenv Python binary is
not executable for that user.

Context and discussion:
https://chatgpt.com/share/6930230d-d7e0-800f-a5dc-67d7f75020e5
2025-12-03 12:46:45 +01:00
a31ef07718 Refactor CI workflows and fix timezone handling in containers
- Renamed test-cli.yml to test-code.yml and updated job name.
- Extended timeout for test-deploy workflow from 30 to 240 minutes.
- Skipped Ansible timezone configuration inside Docker/Podman/containerd to avoid write errors in CI.
- Added --skip-tests to the initial deploy step for improved CI stability.

Origin: https://chatgpt.com/share/69301c58-6628-800f-9e3a-f026c01b6e17
2025-12-03 12:17:59 +01:00
d12f7a10a6 Add optional --become-password support with automatic Vault encryption
- Implement ensure_become_password() to handle explicit, generated, and existing become passwords
- Integrate VaultHandler for encrypted ansible_become_password storage
- Add CLI parameter --become-password to inventory creation workflow
- Ensure backwards compatibility: existing passwords remain untouched unless explicitly overridden
- Add unit test verifying non-overwrite behaviour when no password is provided
- Part of migration and refactoring for Ansible 2.20 upgrade

Reference: https://chatgpt.com/share/69301a6d-e920-800f-b19c-e5ca7c3bdd24
2025-12-03 12:09:47 +01:00
e22893bdcb Optimized test_deploy.sh for the new stream 2025-12-03 11:12:32 +01:00
716ebef33b Refactor task includes and update variable handling for Ansible 2.20 migration
This commit updates multiple roles to ensure compatibility with Ansible 2.20.
Several include paths and task-loading mechanisms required adjustments,
as Ansible 2.20 applies stricter evaluation rules for complex Jinja expressions
and no longer resolves certain relative include paths the way Ansible 2.18 did.

Key changes:
- Replaced legacy once_finalize.yml and once_flag.yml with the new structure
  under tasks/utils/once/finalize.yml and tasks/utils/once/flag.yml.
- Updated all include_tasks statements to use 'path_join' with playbook_dir,
  ensuring deterministic and absolute file resolution across roles.
- Fixed all network helper includes by converting direct relative paths such as
  'roles/docker-compose/tasks/utils/network.yml' to proper Jinja-evaluated paths.
- Normalized MATOMO_* variable names for consistency with the updated variable
  scope behavior in Ansible 2.20.
- Removed deprecated patterns that were implicitly supported in Ansible 2.18
  but break under the more strict variable and path resolution model in 2.20.

These changes are part of the full migration step required to ensure the
infinito-nexus roles remain stable, deterministic, and forward-compatible with
Ansible 2.20.

Details of the discussion and reasoning can be found in this conversation:
https://chatgpt.com/share/69300a8d-24d4-800f-bec0-e895a695618a
2025-12-03 11:02:34 +01:00
a6ed047765 CLI: Fix playbook output freeze by removing capture_output
The deploy wrapper previously used subprocess.run(..., capture_output=True),
which buffered all Ansible output until the playbook finished.
This made the CLI appear stuck at 'Launching Ansible Playbook…'.

Switching to subprocess.run(cmd) restores live streaming of Ansible output.

Details: https://chatgpt.com/share/693008b4-b7b0-800f-bd35-5a307a76fc59
2025-12-03 10:54:31 +01:00
629e6194f9 Optimized for 2.20 2025-12-03 00:32:49 +01:00
e9b0760d08 Added localhost variable 2025-12-03 00:31:56 +01:00
1cee61d00c Removed no-cache to raise performance 2025-12-03 00:30:53 +01:00
f06460db16 Fix: Automatically set ansible_connection=local for localhost in inventory generator
Adds automatic local Ansible connection settings and new unit test for localhost.
Details: https://chatgpt.com/share/692f7649-d35c-800f-948f-19d45cb93512
2025-12-03 00:29:29 +01:00
cde3991c95 Solved undefined variable bug 2025-12-02 23:37:01 +01:00
1eaeae2187 Add handler whitelist support to no-skipped-handlers integration test
This change introduces a WHITELISTED_HANDLERS mechanism, allowing specific
handlers to be intentionally skipped due to conditional 'False' evaluations
without causing test failures. Improves flexibility while keeping the
architectural policy enforced for all other handlers.

Reference: https://chatgpt.com/share/692f6841-c19c-800f-8d6c-aa1ef48dcf7e
2025-12-02 23:29:36 +01:00
94f97ed1f3 Refactor: Migrate deprecated Ansible facts to ansible_facts[] syntax
Why:
- Ansible 2.20+ deprecates INJECT_FACTS_AS_VARS and direct usage of top-level ansible_* facts.
- This change updates all affected roles and vars files to the new supported syntax.
- Ensures compatibility with upcoming Ansible 2.24 removal of implicit fact injection.

Conversation reference:
https://chatgpt.com/share/692f639b-1380-800f-9f18-732f7108e9e2
2025-12-02 23:09:46 +01:00
46174125bc Refine deploy CLI, test-deploy workflow and Ansible output
Changes:
- Update GitHub Actions test-deploy workflow to run three staged deploys (normal+debug, reset+debug, async) using inventory-generated vault password files.
- Switch Ansible stdout_callback to ansible.builtin.default and enable YAML-style result_format via callback_default.
- Refactor cli/deploy.py: typed run_ansible_playbook(), structured MODE_* handling, better error reporting, and preserved vault/interactive behaviour.
- Add unit tests for deploy CLI (bool parsing, MODE_* loading, dynamic args, validation, and ansible-playbook command construction) under tests/unit/cli/test_deploy.py.

Context: see ChatGPT conversation on 2025-12-02: https://chatgpt.com/share/692f1035-6bc4-800f-91a9-342db54e1a75
2025-12-02 20:25:26 +01:00
8a453be4b9 Removed unnecessary warning 2025-12-02 19:36:01 +01:00
f21bf5d459 Improve test-deploy workflow:
- Switch to Python-based vault password generation
- Export VAULT_PASSWORD for internal container usage
- Add first deploy with --debug
- Add second deploy with --reset --debug
- Add third async deploy (no debug)
- Remove incorrect volume copy step and create vault file inside container
Conversation reference: https://chatgpt.com/share/692f1035-6bc4-800f-91a9-342db54e1a75
2025-12-02 19:33:07 +01:00
de121338cf Fix MSMTP Mailu routine loading condition
- Correct grouping of reachability check
- Replace incorrect boolean cast for mailu_token with length check
- Load Mailu routines only when host is unreachable or token is missing

Details: https://chatgpt.com/share/692f1e58-0d6c-800f-9699-e9a26f1e8db9
2025-12-02 18:14:16 +01:00
20ecb62afe CI: Improve Docker reliability for pacman by enforcing host networking
This change updates test-cli.yml to use --network=host for docker build
and docker run steps. This significantly reduces intermittent Arch mirror
timeouts observed in local and CI environments.

Reference:
https://chatgpt.com/share/692f1bd7-f144-800f-b2ac-900d78a69e9d
2025-12-02 18:03:36 +01:00
63f6723106 Added GitHub Workflow Draft: Test deploy; Version 2 - https://chatgpt.com/share/692f1035-6bc4-800f-91a9-342db54e1a75 2025-12-02 17:33:24 +01:00
48cd7743b5 Refactor reachability checks for Matomo and Mailu
- Replace status_code [200,301,302] with explicit 'status_code: 200'
- Use '(status | default(0) | int) != 200' for consistent reachability detection
- Remove deprecated Jinja usage inside when-conditions
- Replace string-rendered conditions with native boolean checks
- Improve Mailu routine trigger logic by tightening status evaluation
- Cleanup unused no_log directives

Reference: https://chatgpt.com/share/692f04b5-5698-800f-a355-9e9b70cf97d7
2025-12-02 16:25:21 +01:00
4b5ba892ba Introduced SSL_ENABLED flag 2025-12-02 13:51:22 +01:00
5b18f39ccd Extend inventory create CLI with include/ignore filters and SSL/network defaults - https://chatgpt.com/share/692edecd-54c4-800f-b01b-35cf395a60f0 2025-12-02 13:44:16 +01:00
d0d24547c2 Activated blob: for mastodon 2025-12-02 13:17:12 +01:00
fe496d4800 Deactivated CSS for ESPOCRM by Default 2025-12-02 12:10:15 +01:00
4ee208ffff Merge branch 'master' of github.com:kevinveenbirkenbach/infinito-nexus 2025-12-02 12:00:03 +01:00
0756e9d06e Optimized database variables 2025-12-02 11:59:55 +01:00
c0e26275f8 Refactor defaults generation, credential creation, and inventory management
### Overview
This commit introduces a broad set of improvements across the defaults
generator, credential creation subsystem, inventory creation workflow,
and InventoryManager core logic.

### Major Changes
- Support empty or  config/main.yml in defaults generator and ensure that
  applications with empty configs are still included in defaults_applications.
- Add '--snippet' and '--allow-empty-plain' modes to create/credentials.py
  with non-destructive merging and correct plain-secret handling.
- Ensure empty strings for 'plain' credentials are never encrypted.
- Update InventoryManager to fully support allow_empty_plain and prevent
  accidental overwriting or encrypting existing VaultScalar or dict values.
- Add full-size implementation of cli/create/inventory.py including
  dynamic inventory building, role filtering, host_vars management, and
  parallelised credential snippet generation.
- Fix schemas (Magento, Nextcloud, OAuth2-Proxy, keyboard-color, etc.) to
  align with the new credential model and avoid test failures.
- Improve get_app_conf consistency by ensuring credentials.* paths are
  always resolvable for applications even when config/main.yml is empty.

### Added Test Coverage
- Unit tests for defaults generator handling empty configs.
- Full test suite for create/inventory.py including merge logic and
  vault-safe host_vars loading.
- Extensive tests for InventoryManager: plain-secret behavior,
  vault handling, and recursion logic.
- Update or remove outdated tests referencing old schema behaviour.

### Context
This commit is associated with a refactoring and debugging session documented here:
https://chatgpt.com/share/692ec0e1-5018-800f-b568-d09a53e9d0ee
2025-12-02 11:54:55 +01:00
13b10ff85b Refactor docker-compose/core and Discourse reset logic
- Move docker-container role loading after directory creation in docker-compose/01_core.yml
- Extend allowed non-fatal errors for docker network disconnect (network missing, container missing, not found)
- Extend allowed non-fatal errors for ./launcher destroy (missing script, missing directory, not found)

Details: https://chatgpt.com/share/692ea63e-7738-800f-bdf1-011e96dc28e5
2025-12-02 09:41:49 +01:00
5320a5d20c Improve infinito CLI global and full help:
- Add ANSI color fallback when colorama is missing
- Refactor global help into print_global_help() and reuse for --help and --help-all
- Enhance show_full_help_for_all() with colorful Subcommand/File headers
- Extend unit tests for global help, child sound handling, and failure loop

Reference: https://chatgpt.com/share/692e88de-39f4-800f-ab7f-5ac178698831/share/this-conversation
2025-12-02 08:17:06 +01:00
1064afc0dc Add --help-all global flag, implement full CLI help printer, extend Usage output, and add comprehensive unit tests for color_text, nested command discovery, error fallback in extract_description_via_help, and subprocess invocation in show_full_help_for_all.
Reference: https://chatgpt.com/share/692e88de-39f4-800f-ab7f-5ac178698831
2025-12-02 07:36:50 +01:00
8314d7e6a6 Refactor DB initialization handling: externalize database_init flag for svc-db-mariadb and svc-db-postgres, remove internal auto-detection, and pass explicit init signal from sys-stk-back-stateful. Improves clarity, avoids incorrect credential lookups, and stabilizes central DB setup.
Reference: ChatGPT conversation https://chatgpt.com/share/692def1c-a79c-800f-b7dd-35e1845424bf
2025-12-01 20:40:30 +01:00
116c20d61d Refactor Nextcloud fullstack and config tasks:
- Load proxy in fullstack
- Simplify config merging logic
- Improve handler flushing and container config update

Context: https://chatgpt.com/share/692dc9d4-a884-800f-85e5-e92471c7b52b
2025-12-01 18:01:25 +01:00