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.

68 lines
2.0 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. INVENTORY=$(PWD)/../inventory/sample/${CI_JOB_NAME}-${BUILD_NUMBER}.ini
  2. $(HOME)/.ssh/id_rsa:
  3. mkdir -p $(HOME)/.ssh
  4. echo $(PRIVATE_KEY) | base64 -d > $(HOME)/.ssh/id_rsa
  5. chmod 400 $(HOME)/.ssh/id_rsa
  6. init-gce: $(HOME)/.ssh/id_rsa
  7. # echo $(GCE_PEM_FILE) | base64 -d > $(HOME)/.ssh/gce
  8. echo "$(GCE_CREDENTIALS_B64)" | base64 -d > $(HOME)/.ssh/gce.json
  9. init-do: $(HOME)/.ssh/id_rsa
  10. echo $(DO_PRIVATE_KEY) | base64 -d > $(HOME)/.ssh/id_rsa
  11. init-packet:
  12. echo $(PACKET_VM_SSH_PRIVATE_KEY) | base64 -d > $(HOME)/.ssh/id_rsa
  13. chmod 400 $(HOME)/.ssh/id_rsa
  14. create-gce: init-gce
  15. ansible-playbook cloud_playbooks/create-gce.yml -i local_inventory/hosts.cfg -c local \
  16. $(LOG_LEVEL) \
  17. -e @"files/${CI_JOB_NAME}.yml" \
  18. -e gce_credentials_file=$(HOME)/.ssh/gce.json \
  19. -e gce_project_id=$(GCE_PROJECT_ID) \
  20. -e gce_service_account_email=$(GCE_ACCOUNT) \
  21. -e inventory_path=$(INVENTORY) \
  22. -e test_id=$(TEST_ID) \
  23. -e preemptible=$(GCE_PREEMPTIBLE)
  24. delete-gce:
  25. ansible-playbook -i $(INVENTORY) cloud_playbooks/delete-gce.yml -c local \
  26. $(LOG_LEVEL) \
  27. -e @"files/${CI_JOB_NAME}.yml" \
  28. -e test_id=$(TEST_ID) \
  29. -e gce_project_id=$(GCE_PROJECT_ID) \
  30. -e gce_service_account_email=$(GCE_ACCOUNT) \
  31. -e gce_credentials_file=$(HOME)/.ssh/gce.json \
  32. -e inventory_path=$(INVENTORY)
  33. create-do: init-do
  34. ansible-playbook cloud_playbooks/create-do.yml -i local_inventory/hosts.cfg -c local \
  35. ${LOG_LEVEL} \
  36. -e @"files/${CI_JOB_NAME}.yml" \
  37. -e inventory_path=$(INVENTORY) \
  38. -e test_id=${TEST_ID}
  39. delete-do:
  40. ansible-playbook -i $(INVENTORY) cloud_playbooks/create-do.yml -c local \
  41. $(LOG_LEVEL) \
  42. -e @"files/${CI_JOB_NAME}.yml" \
  43. -e state=absent \
  44. -e test_id=${TEST_ID} \
  45. -e inventory_path=$(INVENTORY)
  46. create-packet: init-packet
  47. ansible-playbook cloud_playbooks/create-packet.yml -c local \
  48. $(LOG_LEVEL) \
  49. -e @"files/${CI_JOB_NAME}.yml" \
  50. -e test_id=$(TEST_ID) \
  51. -e inventory_path=$(INVENTORY)
  52. delete-packet:
  53. ansible-playbook cloud_playbooks/delete-packet.yml -c local \
  54. $(LOG_LEVEL) \
  55. -e @"files/${CI_JOB_NAME}.yml" \
  56. -e test_id=$(TEST_ID) \
  57. -e inventory_path=$(INVENTORY)