]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
docker-compose: Optionally use an inventory repo
authorZack Cerza <zack@redhat.com>
Fri, 25 Mar 2022 17:11:38 +0000 (11:11 -0600)
committerZack Cerza <zack@redhat.com>
Mon, 28 Mar 2022 21:31:40 +0000 (15:31 -0600)
This is being added to support "real" testnodes without having to
manually copy inventory fragments over.

Signed-off-by: Zack Cerza <zack@redhat.com>
docs/docker-compose/Dockerfile
docs/docker-compose/start.sh

index 5b46ea239a74432724d82e02cf03bc2d31077b37..adcf8246154124adea497c6908ab6c020a70b53c 100644 (file)
@@ -32,4 +32,6 @@ RUN \
     chmod +x /teuthology/bootstrap && \
     ./bootstrap
 COPY teuthology.sh /
+RUN mkdir -p /etc/ansible
+COPY ansible_inventory/hosts ansible_inventory/secrets /etc/ansible/
 ENTRYPOINT /teuthology.sh
\ No newline at end of file
index c48530b2a26a97e9b970e90b8944600ebfd61272..7917e00250d8ebf41bb733aff48c6750fc1d66cd 100755 (executable)
@@ -9,6 +9,22 @@ if [ ! -d ./teuthology ]; then
     -b ${TEUTHOLOGY_BRANCH:-$(git branch --show-current)} \
     https://github.com/ceph/teuthology.git
 fi
+if [ -n "$ANSIBLE_INVENTORY_REPO" ]; then
+    basename=$(basename $ANSIBLE_INVENTORY_REPO | cut -d. -f1)
+    if [ ! -d "$basename" ]; then
+        git clone \
+            --depth 1 \
+            $ANSIBLE_INVENTORY_REPO
+    fi
+    mkdir -p teuthology/ansible_inventory
+    cp -rf $basename/ansible/ teuthology/ansible_inventory
+    if [ ! -d teuthology/ansible_inventory/hosts ]; then
+        mv -f teuthology/ansible_inventory/inventory teuthology/ansible_inventory/hosts
+    fi
+fi
+# Make the hosts and secrets directories, so that the COPY instruction in the 
+# Dockerfile does not cause a build failure when not using this feature.
+mkdir -p teuthology/ansible_inventory/hosts teuthology/ansible_inventory/secrets
 
 cp .teuthology.yaml teuthology/
 cp Dockerfile teuthology/