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.

74 lines
2.1 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-tf:
  15. ./scripts/create-tf.sh
  16. delete-tf:
  17. ./scripts/delete-tf.sh
  18. create-gce: init-gce
  19. ansible-playbook cloud_playbooks/create-gce.yml -i local_inventory/hosts.cfg -c local \
  20. $(LOG_LEVEL) \
  21. -e @"files/${CI_JOB_NAME}.yml" \
  22. -e gce_credentials_file=$(HOME)/.ssh/gce.json \
  23. -e gce_project_id=$(GCE_PROJECT_ID) \
  24. -e gce_service_account_email=$(GCE_ACCOUNT) \
  25. -e inventory_path=$(INVENTORY) \
  26. -e test_id=$(TEST_ID) \
  27. -e preemptible=$(GCE_PREEMPTIBLE)
  28. delete-gce:
  29. ansible-playbook -i $(INVENTORY) cloud_playbooks/delete-gce.yml -c local \
  30. $(LOG_LEVEL) \
  31. -e @"files/${CI_JOB_NAME}.yml" \
  32. -e test_id=$(TEST_ID) \
  33. -e gce_project_id=$(GCE_PROJECT_ID) \
  34. -e gce_service_account_email=$(GCE_ACCOUNT) \
  35. -e gce_credentials_file=$(HOME)/.ssh/gce.json \
  36. -e inventory_path=$(INVENTORY)
  37. create-do: init-do
  38. ansible-playbook cloud_playbooks/create-do.yml -i local_inventory/hosts.cfg -c local \
  39. ${LOG_LEVEL} \
  40. -e @"files/${CI_JOB_NAME}.yml" \
  41. -e inventory_path=$(INVENTORY) \
  42. -e test_id=${TEST_ID}
  43. delete-do:
  44. ansible-playbook -i $(INVENTORY) cloud_playbooks/create-do.yml -c local \
  45. $(LOG_LEVEL) \
  46. -e @"files/${CI_JOB_NAME}.yml" \
  47. -e state=absent \
  48. -e test_id=${TEST_ID} \
  49. -e inventory_path=$(INVENTORY)
  50. create-packet: init-packet
  51. ansible-playbook cloud_playbooks/create-packet.yml -c local \
  52. $(LOG_LEVEL) \
  53. -e @"files/${CI_JOB_NAME}.yml" \
  54. -e test_id=$(TEST_ID) \
  55. -e inventory_path=$(INVENTORY)
  56. delete-packet:
  57. ansible-playbook cloud_playbooks/delete-packet.yml -c local \
  58. $(LOG_LEVEL) \
  59. -e @"files/${CI_JOB_NAME}.yml" \
  60. -e test_id=$(TEST_ID) \
  61. -e inventory_path=$(INVENTORY)