Repository navigation
feat(aap_cleanup): add role to remove AAP artifacts created by aap_seed - #123
Merged
Merged
Conversation
Adds the aap_cleanup role and vmf_cleanup_aap.yml playbook to tear down AAP Configuration-as-Code objects seeded by aap_seed — job templates, credentials, credential types, projects, execution environments, hosts, inventories, and the organization. Features: - Master switch (aap_cleanup_all, default: true) removes everything - Individual toggles for selective removal when aap_cleanup_all is false - Object name lists can be narrowed to target specific items - Removal order respects dependencies (templates first, org last) - Credential names auto-discovered from inventory groups - Organization deleted via gateway API (AAP 2.5 compatible) Tested: full seed → cleanup round-trip against AAP 2.5 homelab. Co-authored-by: Cursor <cursoragent@cursor.com>
tech2734
force-pushed
the
feat/aap-cleanup
branch
from
October 27, 2026 14:25
7f085a7 to
d0dbf2c
Compare
…ection Replace individual ansible.controller.* module calls with the same infra.aap_configuration dispatch pattern that aap_seed uses, but in reverse (state: absent). Key changes: - Discover resources via AAP API (scoped to target org) - Build state:absent lists and dispatch through CaC collection - Add dry-run mode (aap_cleanup_dry_run) - Remove hardcoded object name lists (dynamic discovery) - Add _build_absent_resources.yml reusable include task - Hosts scoped by inventory__organization for safety - Organization removal filtered by name to avoid touching Default org - Simplify defaults and argument specs to match new approach Co-authored-by: Cursor <cursoragent@cursor.com>
sabre1041
requested changes
Oct 29, 2026
sabre1041
left a comment
Contributor
There was a problem hiding this comment.
One requested change and one question
- Author: Red Hat CoP → Red Hat - License: GPL-3.0-or-later → GPL-3.0-only - Remove platforms and galaxy_tags (match collection convention) Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
|
@tech2734 Thanks for updating the galaxy metadata file. Still interested in your thoughts on the |
Author
|
@sabre1041 I am still on the fence regarding the implicit vs. explicit. I see pros/cons with either. Maybe we can get others' opinions on this. |
Require an explicit opt-in — either aap_cleanup_all=true or at least one individual toggle — so selective cleanup only removes chosen categories. Co-authored-by: Cursor <cursoragent@cursor.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
aap_cleanuprole andvmf_cleanup_aap.ymlplaybook that removes all AAP objects created byaap_seed.What it does
Removes objects in dependency order:
Toggles
aap_cleanup_all: true(default) removes everythingaap_cleanup_all: falseand enable per-category toggles (aap_cleanup_templates,aap_cleanup_credentials, etc.)Files added
roles/aap_cleanup/defaults/main.yml— variables with cascade from inventoryroles/aap_cleanup/tasks/main.yml— removal tasks usingmodule_defaultsroles/aap_cleanup/meta/argument_specs.yml— full argument specsroles/aap_cleanup/meta/main.yml— galaxy metadataroles/aap_cleanup/README.md— auto-generated docsplaybooks/vmf_cleanup_aap.yml— playbook (usesimport_role, consistent with other playbooks)Testing