From: Zack Cerza Date: Tue, 2 Jan 2024 18:58:36 +0000 (-0700) Subject: Install ansible collections individually X-Git-Tag: 1.2.0~59^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=efb3e31bed5929a69979a84c82c9a0248070cdeb;p=teuthology.git Install ansible collections individually Going forward, we can maintain our specific collection requirements in requirements.yml. Signed-off-by: Zack Cerza --- diff --git a/.gitignore b/.gitignore index 19ded7805..68a366c73 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,5 @@ docs/teuthology.*.rst # vscode .vscode/ + +.ansible diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 000000000..c7bd5e20d --- /dev/null +++ b/ansible.cfg @@ -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 diff --git a/bootstrap b/bootstrap index 96e87f1f2..534288999 100755 --- 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/containers/teuthology-dev/Dockerfile b/containers/teuthology-dev/Dockerfile index a486644d8..b39e0cdf3 100644 --- a/containers/teuthology-dev/Dockerfile +++ b/containers/teuthology-dev/Dockerfile @@ -17,7 +17,7 @@ RUN apt-get update && \ lsb-release && \ apt-get clean all WORKDIR /teuthology -COPY requirements.txt bootstrap /teuthology/ +COPY requirements.txt requirements.yml ansible.cfg bootstrap /teuthology/ RUN \ cd /teuthology && \ mkdir ../archive_dir && \ diff --git a/docs/docker-compose/teuthology/Dockerfile b/docs/docker-compose/teuthology/Dockerfile index 5587489d1..60cb3f687 100644 --- a/docs/docker-compose/teuthology/Dockerfile +++ b/docs/docker-compose/teuthology/Dockerfile @@ -18,7 +18,7 @@ RUN apt-get update && \ lsb-release && \ apt-get clean all WORKDIR /teuthology -COPY requirements.txt bootstrap /teuthology/ +COPY requirements.txt requirements.yml ansible.cfg bootstrap /teuthology/ RUN \ cd /teuthology && \ mkdir ../archive_dir && \ @@ -40,4 +40,4 @@ RUN \ chmod 600 $HOME/.ssh/${SSH_PRIVKEY_FILE} && \ echo "StrictHostKeyChecking=no" > $HOME/.ssh/config && \ echo "UserKnownHostsFile=/dev/null" >> $HOME/.ssh/config -ENTRYPOINT /teuthology.sh \ No newline at end of file +ENTRYPOINT /teuthology.sh diff --git a/requirements.yml b/requirements.yml new file mode 100644 index 000000000..ec47f6713 --- /dev/null +++ b/requirements.yml @@ -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 + diff --git a/teuthology/task/ansible.py b/teuthology/task/ansible.py index a65a983f6..d27137d12 100644 --- a/teuthology/task/ansible.py +++ b/teuthology/task/ansible.py @@ -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 /.ansible/ + # This is the same path used in /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)