Browse Source

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
Max Gautier 1 month ago
parent
commit
a8e7238c9f
Failed to extract signature
4 changed files with 5 additions and 8 deletions
  1. 1
      .gitlab-ci.yml
  2. 7
      tests/Makefile
  3. 2
      tests/scripts/testcases_cleanup.sh
  4. 3
      tests/scripts/testcases_run.sh

1
.gitlab-ci.yml

@ -22,7 +22,6 @@ variables:
GCE_PREEMPTIBLE: "false"
ANSIBLE_KEEP_REMOTE_FILES: "1"
ANSIBLE_CONFIG: ./tests/ansible.cfg
ANSIBLE_INVENTORY: ./inventory/sample/${CI_JOB_NAME}-${BUILD_NUMBER}.ini
IDEMPOT_CHECK: "false"
RESET_CHECK: "false"
REMOVE_NODE_CHECK: "false"

7
tests/Makefile

@ -1,5 +1,3 @@
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
@ -18,14 +16,13 @@ create-packet: init-packet
-e test_id=$(TEST_ID) \
-e branch="$(CI_COMMIT_BRANCH)" \
-e pipeline_id="$(CI_PIPELINE_ID)" \
-e inventory_path=$(INVENTORY)
-e inventory_path=$(INVENTORY_DIR)
delete-packet: ;
create-vagrant:
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:
vagrant destroy -f

2
tests/scripts/testcases_cleanup.sh

@ -1,7 +1,7 @@
#!/bin/bash
set -euxo pipefail
cd tests && make delete-${CI_PLATFORM} -s ; cd -
make -C tests delete-${CI_PLATFORM} -s
if [ -d ~/.ara ] ; then
tar czvf ${CI_PROJECT_DIR}/cluster-dump/ara.tgz ~/.ara

3
tests/scripts/testcases_run.sh

@ -31,8 +31,9 @@ export ANSIBLE_REMOTE_USER=$SSH_USER
export ANSIBLE_BECOME=true
export ANSIBLE_BECOME_USER=root
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
# Flatcar Container Linux needs auto update disabled

Loading…
Cancel
Save