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.

27 lines
771 B

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