Hello Ansible Community,
I’m exploring how to extend ansible-rulebook
by creating a custom action plugin, and I would appreciate some guidance on the best practices for doing so.
My goal is to create a new, native action called run_kubernetes_job
. I envision this action doing more than just creating a Kubernetes Job from a manifest. I would like the action itself to:
-
Create the Kubernetes Job.
-
Monitor its execution until it completes (succeeds or fails).
-
Implement a retry mechanism if the job fails a certain number of times.
I am aware that I could achieve this by using the existing run_playbook
action and putting all the logic inside a playbook. However, a native run_kubernetes_job
action feels more intuitive and would encapsulate the logic cleanly, making the rulebook more declarative. From the rulebook’s perspective, the action would be a single, synchronous unit that only finishes when the job’s lifecycle is complete.
I apologize if any of my assumptions are technically incorrect or if this isn’t a feasible approach. Any guidance, examples, or pointers to the right resources would be greatly appreciated.
Thank you for your time and help!