Skip to content

feat(vm-gitops-export): capture VM defs for GitOps#6

Closed
stevefulme1 wants to merge 11 commits into
redhat-cop:mainfrom
stevefulme1:feat/vm-gitops-export
Closed

feat(vm-gitops-export): capture VM defs for GitOps#6
stevefulme1 wants to merge 11 commits into
redhat-cop:mainfrom
stevefulme1:feat/vm-gitops-export

Conversation

@stevefulme1

Copy link
Copy Markdown
Contributor

Summary

  • Adds vm_gitops_export role and playbook to capture running VirtualMachine definitions from OpenShift and store cleaned manifests in a Git repository
  • Strips runtime fields (uid, resourceVersion, managedFields, status, etc.) to produce GitOps-ready YAML
  • Supports SSH key and HTTPS token authentication for protected repositories
  • Configurable Git branch, target path, commit author, and commit message

Moved from

Originally submitted as redhat-cop/openshift_virtualization_migration#16 — relocated here as this is day 2 ops functionality (managing VM manifests post-migration via GitOps), not migration logic.

FQCN updated from infra.openshift_virtualization_migration to infra.openshift_virtualization_ops.

Note: This role references vm_collect via include_role. The vm_collect role currently lives in the migration collection — it may need to be ported to ops or referenced as a cross-collection dependency.

Test plan

  • Verify yamllint passes
  • Verify ansible-lint --offline passes production profile
  • Integration test: export VM definitions by name to a test Git repo via SSH
  • Integration test: export VM definitions by label selector via HTTPS token
  • Verify manifests are cleaned of runtime fields
  • Verify idempotency — re-running with unchanged VMs produces no commit
  • Verify cleanup of working directory after export

🤖 Generated with Claude Code

Move from openshift_virtualization_migration repo — this is day 2 ops
functionality for exporting VM definitions to a GitOps repository.

Note: This role references vm_collect which may need to be ported or
added as a cross-collection dependency.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@sabre1041 sabre1041 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stevefulme1 this is really good content. A few comments

  1. Do we want to provide the option for allow users to specify additional keys that should be removed from captured manifests. We define a default set here
  2. We have support for providing a token via HTTP(s). Do we also want to also support user/password?

Comment thread playbooks/vm_gitops_export.yml Outdated
- name: Export VM Definitions to GitOps Repository
hosts: localhost
connection: local
gather_facts: false

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we are referencing ansible_date_time, we will need to keep gather_facts: true

@stevefulme1 stevefulme1 deleted the feat/vm-gitops-export branch May 18, 2026 19:27

@sabre1041 sabre1041 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stevefulme1 saw that this PR was closed. Was that accidental or are you looking to implement a different approach?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants