2016-02-10 10:51:39 +00:00
|
|
|
---
|
|
|
|
- hosts: node1
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
|
|
|
|
- name: Get pod names
|
2016-02-13 13:47:53 +00:00
|
|
|
shell: "/usr/local/bin/kubectl get pods -o json"
|
2016-02-10 10:51:39 +00:00
|
|
|
register: pods
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
pod_names: "{{ (pods.stdout | from_json)['items'] | map(attribute = 'metadata.name') | list }}"
|
|
|
|
pod_ips: "{{ (pods.stdout | from_json)['items'] | map(attribute = 'status.podIP') | list }}"
|
|
|
|
|
|
|
|
- name: Check pods IP are in correct network
|
|
|
|
assert:
|
|
|
|
that: item | ipaddr(kube_pods_subnet)
|
2016-05-11 15:37:15 +00:00
|
|
|
with_items: "{{pod_ips}}"
|
2016-02-10 10:51:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
- name: Ping between pods is working
|
2016-02-13 13:47:53 +00:00
|
|
|
shell: "/usr/local/bin/kubectl exec {{pod_names[0]}} -- ping -c 4 {{ pod_ips[1] }}"
|