CI: make the ansible inventory a directory
Not constraining the inventory to .ini allows us to use dynamic inventory, which is needed for simplifying kubevirt jobs inventory. Also reduces the scope of the ANSIBLE_INVENTORY variable.pull/11530/head
parent
c46e5dc33a
commit
a8e7238c9f
|
@ -22,7 +22,6 @@ variables:
|
||||||
GCE_PREEMPTIBLE: "false"
|
GCE_PREEMPTIBLE: "false"
|
||||||
ANSIBLE_KEEP_REMOTE_FILES: "1"
|
ANSIBLE_KEEP_REMOTE_FILES: "1"
|
||||||
ANSIBLE_CONFIG: ./tests/ansible.cfg
|
ANSIBLE_CONFIG: ./tests/ansible.cfg
|
||||||
ANSIBLE_INVENTORY: ./inventory/sample/${CI_JOB_NAME}-${BUILD_NUMBER}.ini
|
|
||||||
IDEMPOT_CHECK: "false"
|
IDEMPOT_CHECK: "false"
|
||||||
RESET_CHECK: "false"
|
RESET_CHECK: "false"
|
||||||
REMOVE_NODE_CHECK: "false"
|
REMOVE_NODE_CHECK: "false"
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
INVENTORY=$(PWD)/../inventory/sample/${CI_JOB_NAME}-${BUILD_NUMBER}.ini
|
|
||||||
|
|
||||||
init-packet:
|
init-packet:
|
||||||
mkdir -p $(HOME)/.ssh
|
mkdir -p $(HOME)/.ssh
|
||||||
echo $(PACKET_VM_SSH_PRIVATE_KEY) | base64 -d > $(HOME)/.ssh/id_rsa
|
echo $(PACKET_VM_SSH_PRIVATE_KEY) | base64 -d > $(HOME)/.ssh/id_rsa
|
||||||
|
@ -18,14 +16,13 @@ create-packet: init-packet
|
||||||
-e test_id=$(TEST_ID) \
|
-e test_id=$(TEST_ID) \
|
||||||
-e branch="$(CI_COMMIT_BRANCH)" \
|
-e branch="$(CI_COMMIT_BRANCH)" \
|
||||||
-e pipeline_id="$(CI_PIPELINE_ID)" \
|
-e pipeline_id="$(CI_PIPELINE_ID)" \
|
||||||
-e inventory_path=$(INVENTORY)
|
-e inventory_path=$(INVENTORY_DIR)
|
||||||
|
|
||||||
delete-packet: ;
|
delete-packet: ;
|
||||||
|
|
||||||
create-vagrant:
|
create-vagrant:
|
||||||
vagrant up
|
vagrant up
|
||||||
cp $(CI_PROJECT_DIR)/.vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory $(INVENTORY)
|
cp $(CI_PROJECT_DIR)/.vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory $(INVENTORY_DIR)
|
||||||
|
|
||||||
|
|
||||||
delete-vagrant:
|
delete-vagrant:
|
||||||
vagrant destroy -f
|
vagrant destroy -f
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
|
|
||||||
cd tests && make delete-${CI_PLATFORM} -s ; cd -
|
make -C tests delete-${CI_PLATFORM} -s
|
||||||
|
|
||||||
if [ -d ~/.ara ] ; then
|
if [ -d ~/.ara ] ; then
|
||||||
tar czvf ${CI_PROJECT_DIR}/cluster-dump/ara.tgz ~/.ara
|
tar czvf ${CI_PROJECT_DIR}/cluster-dump/ara.tgz ~/.ara
|
||||||
|
|
|
@ -31,8 +31,9 @@ export ANSIBLE_REMOTE_USER=$SSH_USER
|
||||||
export ANSIBLE_BECOME=true
|
export ANSIBLE_BECOME=true
|
||||||
export ANSIBLE_BECOME_USER=root
|
export ANSIBLE_BECOME_USER=root
|
||||||
export ANSIBLE_CALLBACK_PLUGINS="$(python -m ara.setup.callback_plugins)"
|
export ANSIBLE_CALLBACK_PLUGINS="$(python -m ara.setup.callback_plugins)"
|
||||||
|
export ANSIBLE_INVENTORY=${CI_PROJECT_DIR}/inventory/sample/
|
||||||
|
|
||||||
cd tests && make create-${CI_PLATFORM} -s ; cd -
|
make -C tests INVENTORY_DIR=${ANSIBLE_INVENTORY} create-${CI_PLATFORM} -s
|
||||||
ansible-playbook tests/cloud_playbooks/wait-for-ssh.yml
|
ansible-playbook tests/cloud_playbooks/wait-for-ssh.yml
|
||||||
|
|
||||||
# Flatcar Container Linux needs auto update disabled
|
# Flatcar Container Linux needs auto update disabled
|
||||||
|
|
Loading…
Reference in New Issue