]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Install ansible collections individually
authorZack Cerza <zack@redhat.com>
Tue, 2 Jan 2024 18:58:36 +0000 (11:58 -0700)
committerZack Cerza <zack@redhat.com>
Wed, 3 Jan 2024 22:08:10 +0000 (15:08 -0700)
Going forward, we can maintain our specific collection requirements in
requirements.yml.

Signed-off-by: Zack Cerza <zack@redhat.com>
.gitignore
ansible.cfg [new file with mode: 0644]
bootstrap
requirements.yml [new file with mode: 0644]
teuthology/task/ansible.py

index 19ded7805e377909377f6418cb7d5b1bcced1938..68a366c732089ffeee746efbb744b38d0fa21d08 100644 (file)
@@ -28,3 +28,5 @@ docs/teuthology.*.rst
 
 # vscode 
 .vscode/
+
+.ansible
diff --git a/ansible.cfg b/ansible.cfg
new file mode 100644 (file)
index 0000000..c7bd5e2
--- /dev/null
@@ -0,0 +1,4 @@
+[defaults]
+# Store collections in this directory. This is to avoid potential compatibility
+# issues between differently-versioned ansible processes.
+collections_path = .ansible
index 96e87f1f2d0b0639da0208994771c4bf3b9a006b..53428899929f39047bf7df942feb533f05c2f1ba 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -219,3 +219,6 @@ fi
 
 # Check to make sure requirements are met
 ./$VENV/bin/pip check
+
+# Install ansible collections
+./$VENV/bin/ansible-galaxy install -r requirements.yml
diff --git a/requirements.yml b/requirements.yml
new file mode 100644 (file)
index 0000000..ec47f67
--- /dev/null
@@ -0,0 +1,12 @@
+---
+collections:
+  - amazon.aws
+  - name: ansible.netcommon
+    version: "<6.0.0"  # 6.0 requires ansible-core >= 2.14
+  - ansible.posix
+  - name: ansible.utils
+    version: "<3.0.0"  # 3.0 requires ansible-core >= 2.14
+  - community.docker
+  - community.general
+  - community.postgresql
+
index a65a983f6d644a21a9e1baa6cc726e7f5e217a89..d27137d12c0769aeeb9aa0fbd83612bb5c1696ef 100644 (file)
@@ -3,6 +3,7 @@ import logging
 import re
 import requests
 import os
+import pathlib
 import pexpect
 import yaml
 import shutil
@@ -354,6 +355,10 @@ class Ansible(Task):
         environ['ANSIBLE_FAILURE_LOG'] = self.failure_log.name
         environ['ANSIBLE_ROLES_PATH'] = "%s/roles" % self.repo_path
         environ['ANSIBLE_NOCOLOR'] = "1"
+        # Store collections in <repo root>/.ansible/
+        # This is the same path used in <repo root>/ansible.cfg
+        environ['ANSIBLE_COLLECTIONS_PATH'] = str(
+            pathlib.Path(__file__).parents[2] / ".ansible")
         args = self._build_args()
         command = ' '.join(args)
         log.debug("Running %s", command)