try to get all the containers that are included in a pod using ansible.. I 
have no experience in ansible and kubernetes. It is the first I have worked 
with ansible and kubernetes

I use an iteration through the pods to get name's of the containers that 
are include in a pod. I face two problems . The first is that when the 
script is called , I get an error that *item is undefined* . The second one 
is how I will get containers name, image version?

Below is the script

---

- name: Demmo

  k8s_info:

    kind: Pod

    namespace: '{{ meta.namespace }}'

  register: pod_list

# tasks file for configmap

- name: Get the  info from pod

  set_fact:

    podName : "{{ pod_list | json_query(query) }}"

  vars:

    query: 'resources[].{name: metadata.name}'


#use the info from podName and call again kubectl get

- name: Get the container  object 2

  k8s_info:

    kind: Pod

k8s_info    namespace: '{{ meta.namespace }}'

    name: "{{item.name}}"

    loop: "{{podName}}"

    loop_control:

      label: "{{ item.name }}"

  register: pod_list2


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/02df6950-be56-4327-90ed-72967bf1ac9en%40googlegroups.com.

Reply via email to