You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
998 B

  1. ---
  2. - hosts: kube-master[0]
  3. vars:
  4. test_image_repo: busybox
  5. test_image_tag: latest
  6. tasks:
  7. - name: Force binaries directory for Container Linux by CoreOS
  8. set_fact:
  9. bin_dir: "/opt/bin"
  10. when: ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
  11. - set_fact:
  12. bin_dir: "/usr/local/bin"
  13. when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
  14. - name: Create test namespace
  15. shell: "{{bin_dir}}/kubectl create namespace test"
  16. - name: Run a replica controller composed of 2 pods in test ns
  17. shell: "{{bin_dir}}/kubectl run test --image={{test_image_repo}}:{{test_image_tag}} --namespace test --replicas=2 --command -- tail -f /dev/null"
  18. - name: Pods are running
  19. shell: "{{bin_dir}}/kubectl get pods --namespace test --no-headers -o json"
  20. register: run_pods_log
  21. until: [ '(run_pods_log.stdout | from_json)["items"] | map(attribute = "status.phase") | join(",") == "Running,Running"' ]
  22. retries: 18
  23. delay: 10