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
1.9 KiB

7 years ago
7 years ago
7 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-do: init-do
  19. ansible-playbook cloud_playbooks/create-do.yml -i local_inventory/hosts.cfg -c local \
  20. ${ANSIBLE_LOG_LEVEL} \
  21. -e @"files/${CI_JOB_NAME}.yml" \
  22. -e inventory_path=$(INVENTORY) \
  23. -e test_id=${TEST_ID}
  24. delete-do:
  25. ansible-playbook -i $(INVENTORY) cloud_playbooks/create-do.yml -c local \
  26. $(ANSIBLE_LOG_LEVEL) \
  27. -e @"files/${CI_JOB_NAME}.yml" \
  28. -e state=absent \
  29. -e test_id=${TEST_ID} \
  30. -e inventory_path=$(INVENTORY)
  31. create-packet: init-packet
  32. ansible-playbook cloud_playbooks/create-packet.yml -c local \
  33. $(ANSIBLE_LOG_LEVEL) \
  34. -e @"files/${CI_JOB_NAME}.yml" \
  35. -e test_id=$(TEST_ID) \
  36. -e branch="$(CI_COMMIT_BRANCH)" \
  37. -e pipeline_id="$(CI_PIPELINE_ID)" \
  38. -e inventory_path=$(INVENTORY)
  39. delete-packet:
  40. ansible-playbook cloud_playbooks/delete-packet.yml -c local \
  41. $(ANSIBLE_LOG_LEVEL) \
  42. -e @"files/${CI_JOB_NAME}.yml" \
  43. -e test_id=$(TEST_ID) \
  44. -e branch="$(CI_COMMIT_BRANCH)" \
  45. -e pipeline_id="$(CI_PIPELINE_ID)" \
  46. -e inventory_path=$(INVENTORY)
  47. cleanup-packet:
  48. ansible-playbook cloud_playbooks/cleanup-packet.yml -c local \
  49. $(ANSIBLE_LOG_LEVEL)
  50. create-vagrant:
  51. vagrant up
  52. find / -name vagrant_ansible_inventory
  53. cp /builds/kargo-ci/kubernetes-sigs-kubespray/inventory/sample/vagrant_ansible_inventory $(INVENTORY)
  54. delete-vagrant:
  55. vagrant destroy -f