2018-04-10 13:02:33 +00:00
|
|
|
INVENTORY=$(PWD)/../inventory/sample/${CI_JOB_NAME}-${BUILD_NUMBER}.ini
|
2018-02-12 15:04:26 +00:00
|
|
|
|
2018-02-12 10:35:37 +00:00
|
|
|
$(HOME)/.ssh/id_rsa:
|
|
|
|
mkdir -p $(HOME)/.ssh
|
|
|
|
echo $(PRIVATE_KEY) | base64 -d > $(HOME)/.ssh/id_rsa
|
|
|
|
chmod 400 $(HOME)/.ssh/id_rsa
|
|
|
|
|
|
|
|
init-gce: $(HOME)/.ssh/id_rsa
|
|
|
|
# echo $(GCE_PEM_FILE) | base64 -d > $(HOME)/.ssh/gce
|
2018-02-12 14:32:40 +00:00
|
|
|
echo "$(GCE_CREDENTIALS_B64)" | base64 -d > $(HOME)/.ssh/gce.json
|
2018-02-12 10:35:37 +00:00
|
|
|
|
|
|
|
init-do: $(HOME)/.ssh/id_rsa
|
|
|
|
echo $(DO_PRIVATE_KEY) | base64 -d > $(HOME)/.ssh/id_rsa
|
|
|
|
|
|
|
|
create-gce: init-gce
|
|
|
|
ansible-playbook cloud_playbooks/create-gce.yml -i local_inventory/hosts.cfg -c local \
|
|
|
|
$(LOG_LEVEL) \
|
2018-02-12 13:28:59 +00:00
|
|
|
-e @"files/${CI_JOB_NAME}.yml" \
|
2018-02-12 10:35:37 +00:00
|
|
|
-e gce_credentials_file=$(HOME)/.ssh/gce.json \
|
|
|
|
-e gce_project_id=$(GCE_PROJECT_ID) \
|
|
|
|
-e gce_service_account_email=$(GCE_ACCOUNT) \
|
2018-02-12 15:04:26 +00:00
|
|
|
-e inventory_path=$(INVENTORY) \
|
2018-02-12 10:35:37 +00:00
|
|
|
-e test_id=$(TEST_ID) \
|
|
|
|
-e preemptible=$(GCE_PREEMPTIBLE)
|
|
|
|
|
|
|
|
|
|
|
|
delete-gce:
|
2018-02-12 15:04:26 +00:00
|
|
|
ansible-playbook -i $(INVENTORY) cloud_playbooks/delete-gce.yml -c local \
|
2018-02-12 10:35:37 +00:00
|
|
|
$(LOG_LEVEL) \
|
2018-02-12 13:28:59 +00:00
|
|
|
-e @"files/${CI_JOB_NAME}.yml" \
|
2018-02-12 10:35:37 +00:00
|
|
|
-e test_id=$(TEST_ID) \
|
|
|
|
-e gce_project_id=$(GCE_PROJECT_ID) \
|
|
|
|
-e gce_service_account_email=$(GCE_ACCOUNT) \
|
|
|
|
-e gce_credentials_file=$(HOME)/.ssh/gce.json \
|
2018-02-12 15:04:26 +00:00
|
|
|
-e inventory_path=$(INVENTORY)
|
2018-02-12 10:35:37 +00:00
|
|
|
|
|
|
|
create-do: init-do
|
2018-02-12 13:28:59 +00:00
|
|
|
ansible-playbook cloud_playbooks/create-do.yml -i local_inventory/hosts.cfg -c local \
|
2018-02-12 10:35:37 +00:00
|
|
|
${LOG_LEVEL} \
|
2018-02-12 13:28:59 +00:00
|
|
|
-e @"files/${CI_JOB_NAME}.yml" \
|
2018-02-12 15:04:26 +00:00
|
|
|
-e inventory_path=$(INVENTORY) \
|
2018-02-12 10:35:37 +00:00
|
|
|
-e test_id=${TEST_ID}
|
|
|
|
|
|
|
|
|
|
|
|
delete-do:
|
2018-02-12 15:04:26 +00:00
|
|
|
ansible-playbook -i $(INVENTORY) cloud_playbooks/create-do.yml -c local \
|
2018-02-12 14:32:40 +00:00
|
|
|
$(LOG_LEVEL) \
|
2018-02-12 13:28:59 +00:00
|
|
|
-e @"files/${CI_JOB_NAME}.yml" \
|
2018-02-12 10:35:37 +00:00
|
|
|
-e state=absent \
|
|
|
|
-e test_id=${TEST_ID} \
|
2018-02-12 15:04:26 +00:00
|
|
|
-e inventory_path=$(INVENTORY)
|