mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2025-12-14 13:54:37 +03:00
The current way to handle a custom inventory in vagrant is a bit hackish, copy files around and can break Vagrantfile parsing in cornercase scenarios (removing vagrant inventories, or the inventory copied into vagrant inventory). Instead, simply pass additional inventories to the ansible-playbook command lines as raw arguments with `-i`. This also makes supporting multiples inventories trivial, so we add a new `$inventories` variable for that purpose.
43 lines
1.1 KiB
Makefile
43 lines
1.1 KiB
Makefile
INVENTORY=$(PWD)/../inventory/sample/${CI_JOB_NAME}-${BUILD_NUMBER}.ini
|
|
|
|
init-packet:
|
|
mkdir -p $(HOME)/.ssh
|
|
echo $(PACKET_VM_SSH_PRIVATE_KEY) | base64 -d > $(HOME)/.ssh/id_rsa
|
|
chmod 400 $(HOME)/.ssh/id_rsa
|
|
|
|
create-tf:
|
|
./scripts/create-tf.sh
|
|
|
|
delete-tf:
|
|
./scripts/delete-tf.sh
|
|
|
|
create-packet: init-packet
|
|
ansible-playbook cloud_playbooks/create-packet.yml -c local \
|
|
$(ANSIBLE_LOG_LEVEL) \
|
|
-e @"files/${CI_JOB_NAME}.yml" \
|
|
-e test_id=$(TEST_ID) \
|
|
-e branch="$(CI_COMMIT_BRANCH)" \
|
|
-e pipeline_id="$(CI_PIPELINE_ID)" \
|
|
-e inventory_path=$(INVENTORY)
|
|
|
|
delete-packet:
|
|
ansible-playbook cloud_playbooks/delete-packet.yml -c local \
|
|
$(ANSIBLE_LOG_LEVEL) \
|
|
-e @"files/${CI_JOB_NAME}.yml" \
|
|
-e test_id=$(TEST_ID) \
|
|
-e branch="$(CI_COMMIT_BRANCH)" \
|
|
-e pipeline_id="$(CI_PIPELINE_ID)" \
|
|
-e inventory_path=$(INVENTORY)
|
|
|
|
cleanup-packet:
|
|
ansible-playbook cloud_playbooks/cleanup-packet.yml -c local \
|
|
$(ANSIBLE_LOG_LEVEL)
|
|
|
|
create-vagrant:
|
|
vagrant up
|
|
cp $(CI_PROJECT_DIR)/.vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory $(INVENTORY)
|
|
|
|
|
|
delete-vagrant:
|
|
vagrant destroy -f
|