Dear #Ansible #Kubernetes users,
I can tell Ansible to wait until a Kubernetes pod is running and ready using something like this:
- kubernetes.core.k8s_info:
api_version: v1
kind: Pod
namespace: gitlab
label_selectors:
- app=webservice
wait_condition:
status: "True"
type: Ready
wait: true
wait_sleep: 10
wait_timeout: 1800
However, I do not succeed in telling Ansible to wait until a pod was completed successfully. The following code works but detects a pod that is not yet running (PodInitializing) as well and proceeds.
- kubernetes.core.k8s_info:
[...]
wait_condition:
# no "reason" given here
status: "False"
type: Ready
[...]
As soon as I add a "reason" this task runs into a timeout and does no longer work. No matter what I use as the "reason". "Completed", "Succeeded", "Terminated", ...
The module documentation is rather vague on this...
https://docs.ansible.com/ansible/latest/collections/kubernetes/core/k8s_info_module.html