Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
31525ff
Add inventory module migrated from awx.awx/ansible.controller (AAP-91…
jessicamack Sep 14, 2026
68ebccc
Add host module migrated from awx.awx/ansible.controller (AAP-91390)
jessicamack Sep 14, 2026
31cc964
Add inventory_source module migrated from awx.awx/ansible.controller …
jessicamack Sep 14, 2026
e89cfc2
Add inventory_source_update module migrated from awx.awx/ansible.cont…
jessicamack Sep 14, 2026
d3bfab4
Add schedule module migrated from awx.awx/ansible.controller (AAP-91390)
jessicamack Sep 14, 2026
555c7c8
Add job_launch module migrated from awx.awx/ansible.controller (AAP-9…
jessicamack Sep 14, 2026
0f52b52
Fix ansible-lint failure: exclude new scenarios' inventory.yml files
jessicamack Sep 14, 2026
52d8874
Address pr-review skill findings: test and document the new SDK methods
jessicamack Sep 14, 2026
6c3c9c8
Address CodeRabbit review: association safety, check_mode, FK lookup …
jessicamack Sep 14, 2026
ea77661
Extend SDK/mock server for AAP-91391 batch: association preserve flag…
jessicamack Sep 15, 2026
f5b387e
Add execution_environment module migrated from awx.awx/ansible.contro…
jessicamack Sep 15, 2026
9e444b0
Add notification_template module migrated from awx.awx/ansible.contro…
jessicamack Sep 15, 2026
85eb8e3
Add group module migrated from awx.awx/ansible.controller (AAP-91391)
jessicamack Sep 15, 2026
b75c30d
Add project_update module migrated from awx.awx/ansible.controller (A…
jessicamack Sep 15, 2026
0c9295e
Add job_wait module migrated from awx.awx/ansible.controller (AAP-91391)
jessicamack Sep 15, 2026
b8b1109
Add workflow_job_template module migrated from awx.awx/ansible.contro…
jessicamack Sep 15, 2026
a914d67
Refactor job_launch, inventory_source_update, and inventory action pl…
jessicamack Sep 15, 2026
12fafbe
Refactor job_wait, project_update, notification_template, and workflo…
jessicamack Sep 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,17 @@ exclude_paths:
- 'extensions/molecule/inventory.yml'
- 'extensions/molecule/organization_mock/inventory.yml'
- 'extensions/molecule/users_mock/inventory.yml'
- 'extensions/molecule/inventory_mock/inventory.yml'
- 'extensions/molecule/host_mock/inventory.yml'
- 'extensions/molecule/inventory_source_mock/inventory.yml'
- 'extensions/molecule/inventory_source_update_mock/inventory.yml'
- 'extensions/molecule/schedule_mock/inventory.yml'
- 'extensions/molecule/job_launch_mock/inventory.yml'
- 'extensions/molecule/execution_environment_mock/inventory.yml'
- 'extensions/molecule/group_mock/inventory.yml'
- 'extensions/molecule/notification_template_mock/inventory.yml'
- 'extensions/molecule/project_update_mock/inventory.yml'
- 'extensions/molecule/job_wait_mock/inventory.yml'
- 'extensions/molecule/workflow_job_template_mock/inventory.yml'
use_default_rules: true
...
3 changes: 3 additions & 0 deletions changelogs/fragments/aap_91390_host.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- host - add module migrated from awx.awx/ansible.controller
(https://issues.redhat.com/browse/AAP-91390).
4 changes: 4 additions & 0 deletions changelogs/fragments/aap_91390_inventory.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
minor_changes:
- inventory - add module migrated from awx.awx/ansible.controller, including copy_from,
instance_groups/input_inventories associations, and constructed inventory support
(https://issues.redhat.com/browse/AAP-91390).
4 changes: 4 additions & 0 deletions changelogs/fragments/aap_91390_inventory_source.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
minor_changes:
- inventory_source - add module migrated from awx.awx/ansible.controller, including
notification_templates_started/success/error associations
(https://issues.redhat.com/browse/AAP-91390).
10 changes: 10 additions & 0 deletions changelogs/fragments/aap_91390_inventory_source_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
minor_changes:
- inventory_source_update - add module migrated from awx.awx/ansible.controller
to launch an inventory source update (sync)
(https://issues.redhat.com/browse/AAP-91390).
bugfixes:
- Fix the SDK layer's shared operation executor to actually call the API for
an endpoint operation intentionally declared with no request-body fields
(a launch-trigger sub-action), and to resolve any custom path parameter
name declared on an EndpointOperation instead of only ever substituting
a param literally named C(id).
10 changes: 10 additions & 0 deletions changelogs/fragments/aap_91390_job_launch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
minor_changes:
- job_launch - add module migrated from awx.awx/ansible.controller to launch
an Ansible job template (https://issues.redhat.com/browse/AAP-91390).
bugfixes:
- Fix the SDK layer's shared operation executor to still call the API for a
primary create/launch operation when all of its optional body fields
happen to be unset (e.g. job_launch with no prompt overrides) — it was
only correctly distinguishing this from an unused optional secondary
endpoint (like an association or sub-resource) in one of the two
connection-mode implementations.
4 changes: 4 additions & 0 deletions changelogs/fragments/aap_91390_schedule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
minor_changes:
- schedule - add module migrated from awx.awx/ansible.controller, including
credentials/labels/instance_groups associations
(https://issues.redhat.com/browse/AAP-91390).
3 changes: 3 additions & 0 deletions changelogs/fragments/aap_91391_execution_environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- execution_environment - add module migrated from awx.awx/ansible.controller
(https://issues.redhat.com/browse/AAP-91391).
3 changes: 3 additions & 0 deletions changelogs/fragments/aap_91391_group.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- group - add module migrated from awx.awx/ansible.controller
(https://issues.redhat.com/browse/AAP-91391).
3 changes: 3 additions & 0 deletions changelogs/fragments/aap_91391_job_wait.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- job_wait - add module migrated from awx.awx/ansible.controller
(https://issues.redhat.com/browse/AAP-91391).
3 changes: 3 additions & 0 deletions changelogs/fragments/aap_91391_notification_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- notification_template - add module migrated from awx.awx/ansible.controller
(https://issues.redhat.com/browse/AAP-91391).
3 changes: 3 additions & 0 deletions changelogs/fragments/aap_91391_project_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- project_update - add module migrated from awx.awx/ansible.controller
(https://issues.redhat.com/browse/AAP-91391).
3 changes: 3 additions & 0 deletions changelogs/fragments/aap_91391_workflow_job_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- workflow_job_template - add module migrated from awx.awx/ansible.controller
(https://issues.redhat.com/browse/AAP-91391).
58 changes: 58 additions & 0 deletions docs/03-sdk-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,64 @@ class LookupModule(LookupBase):
This allows dynamic lookups (e.g., "find all users whose username contains 'admin'")
without spawning additional processes or triggering SSL fork safety issues.

### Generic Methods for Associations, Copy, and Launch/Wait

Beyond `execute()` and `search_api()`, three more generic methods live on
`BaseAPIClient` (and are implemented identically in `PlatformService` and
`DirectHTTPClient`, with thin `ManagerRPCClient` wrappers) so that association
sub-endpoints, secondary sub-resources, and copy operations never require an
action plugin to touch `manager.session`/HTTP directly:

```python
def manage_associations(self, base_path, resource_id, association_field,
desired_items, lookup_endpoint, lookup_field) -> bool:
"""Sync an association sub-endpoint (e.g. a resource's instance_groups).

Resolves desired_items (names or IDs) to integer IDs, diffs against the
current association list, and issues associate/disassociate POSTs for
the difference. Returns True if anything changed.
"""

def manage_sub_resource(self, base_path, resource_id, sub_path, data=None) -> bool:
"""GET/compare/POST a secondary sub-resource (e.g. survey_spec).

data=None is a no-op; data=={} DELETEs the sub-resource; otherwise POSTs
only if the current value differs. Returns True if changed.
"""

def copy_resource(self, module_name, source_name_or_id, new_name,
copy_endpoint_path) -> dict:
"""POST to a resource's /copy/ sub-endpoint.

Finds the source via execute('find', ...), falling back to an ID-based
lookup, then POSTs {'name': new_name} to {copy_endpoint_path}/{id}/copy/.
Returns the copied resource's raw API response.
"""
```

See `plugins/action/inventory.py` for a full Pattern C example combining
`copy_resource` (for `copy_from`) and `manage_associations` (for
`instance_groups`/`input_inventories`).

**Launch/wait** (Shape 2 resources like `ad_hoc_command`, `job_launch`,
`inventory_source_update`) is handled inside `execute()` itself rather than as
a separate method: `wait`/`interval`/`timeout` are popped off the incoming
`ansible_data` dict before the resource dataclass is built (only when the
target dataclass doesn't declare a field of that name — so a resource with a
genuine `timeout` field, e.g. `job_template`, keeps it), and — when
`wait=True` — `_wait_for_resource_completion()` polls the newly-created
resource via `_find_resource()` until `from_api()` reports a truthy
`finished` (or `event_processing_finished`), raising `WaitTimeoutError`
(carrying the last poll result, so the caller can still report `id`/`status`)
if `timeout` elapses first. `DEFAULT_WAIT_TIMEOUT` (3600s) applies when
`wait=True` but no `timeout` was given.

Adding a new generic method follows the same four-layer rule as everything
else in this SDK: `base_client.py` (abstract, raises `NotImplementedError`) →
`platform_manager.py` → `direct_client.py` → `rpc_client.py`. Skipping the
`rpc_client.py` wrapper is the most common miss — the method works in direct
mode but silently isn't reachable from the action plugin in persistent mode.

---

## SECTION 7: Directory Structure
Expand Down
78 changes: 78 additions & 0 deletions extensions/molecule/execution_environment_mock/cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
# Cleanup: delete execution_environments created by converge.
- name: Cleanup — delete execution_environment (mock, connection local)
hosts: localhost
connection: local
gather_facts: false
vars:
gateway_hostname: "http://127.0.0.1:8000"
gateway_username: "mock"
gateway_password: "testpass"
gateway_validate_certs: false
molecule_ee_name: "Molecule Test EE Local"
tasks:
- name: Delete execution_environment (connection local)
ansible.platform.execution_environment:
name: "{{ molecule_ee_name }}"
state: absent
failed_when: false
vars:
ansible_connection: local

- name: Remove manager survive flag (signals manager to shut down)
ansible.builtin.file:
path: /tmp/ap/.survive
state: absent
vars:
ansible_connection: local

- name: Cleanup — delete execution_environment (mock, http direct)
hosts: localhost
connection: ansible.platform.http
gather_facts: false
vars:
gateway_hostname: "http://127.0.0.1:8000"
gateway_username: "mock"
gateway_password: "testpass"
gateway_validate_certs: false
ansible_platform_use_persistent_connection: false
molecule_ee_name: "Molecule Test EE HTTP Direct"
tasks:
- name: Delete execution_environment (http direct)
ansible.platform.execution_environment:
name: "{{ molecule_ee_name }}"
state: absent
failed_when: false

- name: Remove manager survive flag (signals manager to shut down)
ansible.builtin.file:
path: /tmp/ap/.survive
state: absent
vars:
ansible_connection: local

- name: Cleanup — delete execution_environment (mock, http persistent)
hosts: localhost
connection: ansible.platform.http
gather_facts: false
vars:
gateway_hostname: "http://127.0.0.1:8000"
gateway_username: "mock"
gateway_password: "testpass"
gateway_validate_certs: false
ansible_platform_use_persistent_connection: true
molecule_ee_name: "Molecule Test EE HTTP Persistent"
tasks:
- name: Delete execution_environment (http persistent)
ansible.platform.execution_environment:
name: "{{ molecule_ee_name }}"
state: absent
failed_when: false

- name: Remove manager survive flag (signals manager to shut down)
ansible.builtin.file:
path: /tmp/ap/.survive
state: absent
vars:
ansible_connection: local
...
Loading
Loading