Hi All,

I need help with writing an ansible playbook, where it loops over a few 
pods and checks if any pod is not running, does a describe on it, and 
prints the events (we get when we describe pods).

I'm stuck on the 2nd task here, where I can fetch 'stdout' but cannot 
filter the pod name from stdout. Please suggest how I can implement this.

I'm passing services_to_upgrade as an argument while running the playbook.

- name: Get pod information
  command: "kubectl get pods -l app={{ item }} -o json"
  register: pods_info
  with_items: "{{ services_to_upgrade.keys() }}"

- name: Print pod info
  set_fact:
      pod_name: "{{ pods_info.results| json_query('[*].stdout[]')  }}"

I am looking forward to any suggestions.

Thanks


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/053ec500-6af3-478b-9d57-cafa9020471cn%40googlegroups.com.

Reply via email to