Imported from kenmoini/automation-orchestrator-config (
AGENTS.md). Install upstream withnpx skills add kenmoini/automation-orchestrator-config. Copyright stays with the author.
AGENTS.md — kenmoini.automation_orchestrator_config
Context
This repository is an Ansible Collection (kenmoini.automation_orchestrator_config) that provides modules and roles for managing Red Hat Automation Orchestrator (tech preview, API 1.3.1) resources as code. See CLAUDE.md for the layout and docs/ROLE_TEMPLATE.md for the role contract.
Code Review Guidelines
When reviewing pull requests to this collection, verify the following:
Module Compliance
- Modules subclass
OrchestratorModuleand use the shared auth doc fragment; a new module is listed in theorchestratoraction group inmeta/runtime.yml. - Resource modules use
find_existing, thendelete_if_neededorcreate_or_update, and end withexit_result;_infomodules end withexit_info. - Write-only values are declared in
secret_fields, honorupdate_secrets, and never appear in return values or logs. Nested configs the API needs whole usefull_fields. - Check mode must not change anything; one-shot actions are skipped in check mode.
DOCUMENTATION,EXAMPLESandRETURNare complete, withversion_addedset; the Python header andblack/flake8(line length 160) rules are followed.- New modules have unit tests in
tests/unit/plugins/modules/with mocked HTTP covering create, update, no-change, delete and check mode.
Role Structure Compliance
- New roles follow
docs/ROLE_TEMPLATE.md:defaults/main.yml,tasks/main.yml,meta/main.yml,meta/argument_specs.yml,README.md,tests/test.ymlandtests/configs/. meta/main.ymldeclares the dependency onglobal_vars.defaults/main.ymlinitializes the resource list to[]and includes the standard variables for secure logging, async retries, async delay, loop delay, enforce defaults andorchestrator_configuration_async_dir.- Role names use the
orchestrator_prefix. - The identifying key (not always
name) is used in the module task, loop label and README, and is captured bycollect_async_status/tasks/handle_error.yml(name,username,project,workflow,role,user,group,service_account,identifier,key); a new key must be added there - Roles whose items may carry secrets (users, credentials, identity providers, service account credentials, execution launch) default secure logging to
true; flag any such role defaulting tofalse
Async Task Pattern
All resource roles must follow the async block pattern:
- A block with
ansible_async_dirandno_logset - The module task loops over the resource list with
asyncandpoll: 0 - A "Flag for errors (check mode only)" task using
ansible.builtin.set_factto seterror_flag - An
include_roleofkenmoini.automation_orchestrator_config.collect_async_statusto wait for results, passingcas_async_delay,cas_async_retries,cas_secure_logging,cas_job_async_results_item,cas_register_subvar,cas_error_list_var_name, andcas_object_label - An
alwaysblock that cleans up async result files viaansible.builtin.async_statuswithmode: cleanup
Variable Naming
- Internal loop variables use double-underscore prefix:
__orchestrator_<res>_item - Async result variables follow:
__orchestrator_<res>_job_asyncand__orchestrator_<res>_job_async_results_item - Variable names must match pattern
^[a-z_][a-z0-9_]*$ - Loop variable prefix must match
^(__|{role}_)
Task Naming
- Task names must follow the
"{stem} | "prefix pattern enforced by ansible-lint - Example:
"Managing Projects"for the projects role task
Authentication Parameters
- Modules take
orchestrator_host,orchestrator_username,orchestrator_password,orchestrator_token,orchestrator_client_id,orchestrator_client_secret,validate_certs,request_timeout - Roles pass
orchestrator_hostname,orchestrator_username,orchestrator_password,orchestrator_token,orchestrator_client_id,orchestrator_client_secret,orchestrator_validate_certs,orchestrator_request_timeoutwithdefault(omit, true)fallbacks - No mutual exclusion between auth methods;
authenticate()applies the precedence token > client credentials > username/password (required_togetherfor each pair)
Dispatch Integration
- New roles must be added to the dispatcher list in
roles/dispatch/defaults/main.yml, in dependency order - Current order: settings, groups, identity_providers, users, projects, policies, roles, service_accounts, role_assignments, credentials, integrations, service_account_credentials, workflows, execution_launch, approval_decisions (keep
vars/main.yml,meta/argument_specs.ymland the dispatch README table in sync) - The entry must specify
role,var, andtagsat minimum, and the dispatch README table must be updated
Documentation
- Role
README.mdmust include: description, variable table (with defaults, required flag, description, example), data structure documentation with YAML examples, and a license link meta/argument_specs.ymlmust fully describe all role options with types and defaults- New roles and modules appear in the tables of the top-level
README.md - Behavior that depends on an unconfirmed API assumption is recorded in
docs/API_COMPATIBILITY.md
Changelog
- Every feature or bugfix PR must include a changelog fragment in
changelogs/fragments/ - Fragment file must be valid YAML with
...document end marker - Use appropriate category:
minor_changes,major_changes,bugfixes,breaking_changes, etc.
Testing
- Unit tests cover new module behavior;
make pytestandmake lintpass, and CI runsansible-test sanityandunits - New roles include test data in
roles/<role>/tests/configs/and atest.ymlplaybook, plus an entry intests/configs/and the live harness when applicable - Live test objects are named
aoc-test-*;tests/auth.ymland any credentials are never committed
Linting Standards
- YAML files must use
.ymlextension - YAML files must end with
...(document-end marker) - 2-space indentation, no trailing whitespace
- Jinja2 variables must have spaces:
{{ var }}not{{var}} - ansible-lint profile:
production - Python code:
blackformatting (line length 160),flake8compliance
PR Submission
When submitting PRs:
- Run
make lint(pre-commit) andmake pytestbefore pushing - Include a changelog fragment
