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.

33 lines
1.0 KiB

  1. ---
  2. - hosts: localhost
  3. become: false
  4. gather_facts: no
  5. vars:
  6. cloud_machine_type: g1-small
  7. tasks:
  8. - name: replace_test_id
  9. set_fact:
  10. test_name: "{{test_id |regex_replace('\\.', '-')}}"
  11. - name: Create gce instances
  12. gce:
  13. instance_names: "k8s-{{test_name}}-1,k8s-{{test_name}}-2,k8s-{{test_name}}-3"
  14. machine_type: "{{ cloud_machine_type }}"
  15. image: "{{ cloud_image }}"
  16. service_account_email: "{{ gce_service_account_email }}"
  17. pem_file: "{{ gce_pem_file }}"
  18. project_id: "{{ gce_project_id }}"
  19. zone: "{{cloud_region}}"
  20. metadata: '{"test_id": "{{test_id}}", "network": "{{kube_network_plugin}}"}'
  21. tags: "build-{{test_name}},{{kube_network_plugin}}"
  22. register: gce
  23. - name: Template the inventory
  24. template:
  25. src: ../templates/inventory-gce.j2
  26. dest: "{{ inventory_path }}"
  27. - name: Wait for SSH to come up
  28. wait_for: host={{item.public_ip}} port=22 delay=10 timeout=180 state=started
  29. with_items: "{{gce.instance_data}}"