Set up CVMFS repositories on a Stratum-0 machine, Stratum-1 (with reverse proxy) machines, forward caching proxy machines, and client machines.
The setup is based on the following documentation:
Table of Contents:
Install this collection with
ansible-galaxy collection install git+https://github.com/max-fatouros/cvmfs-ansible-setup.git
-
Copy the
hosts.yml
file. Replace the hosts under the stratum-0, stratum-1, proxy, client, and cvmfs groups with the ones you want to use. If you would like to not use stratum-1s and/or proxies, leave the values of theirhost:
key blank, but do not remove thestratum-1:
orproxies:
keys entirely. The format of this file is described in How to build your inventory. This file is also where the parameters for the setup are configured. -
Create a copy of this
ansible.cfg
file. -
With both the
hosts.yml
andansible.cfg
files in your working directory. Test that things are working with the commandansible-playbook cvmfs.setup.ping
-
Many of the ansible commands require
sudo
privileges on the remote machines. If you would like to disable the sudo password on the remote machines so that the playbooks in this collection can be run without a password, first run the following command, enter the sudo password for the machine which will have its sudo password removed, then press enter.read -s PASS
After this, run
ansible-playbook -l <host> -e "ansible_sudo_pass=$PASS" cvmfs.setup.remove_sudo-pass
where
<hosts>
is the hostname (specified inhosts.yaml
) of the machine whose sudo password we are removing.
-
Run
ansible-playbook cvmfs.setup.all
this is equivalent to running
ansible-playbook cvmfs.setup.stratum_0 ansible-playbook cvmfs.setup.stratum_1s ansible-playbook cvmfs.setup.proxies ansible-playbook cvmfs.setup.clients
after running
cvmfs.setup.all
, any of the individual playbooks above can be re-run if needed. However, they all rely oncvmfs.setup.stratum_0
having been run once in order for the stratum-0 public keys to be copied over properly. -
To ensure that the environment was set up correctly, you could try propagating a test file through all the machines. i.e. from
stratum-0 -> stratum-1 -> proxy -> client
By following these instructions, we can do this with the following commands
-
On the Stratum-0
Set an environment variable to the name of your repository.
MY_REPO_NAME=<repo.org.tld>
Then, run these commands1
cvmfs_server transaction ${MY_REPO_NAME} echo '#!/bin/bash' > /cvmfs/${MY_REPO_NAME}/hello.sh echo 'echo hello' >> /cvmfs/${MY_REPO_NAME}/hello.sh chmod a+x /cvmfs/${MY_REPO_NAME}/hello.sh cvmfs_server publish ${MY_REPO_NAME}
-
On a Stratum-1
Synchronize the file with2
cvmfs_server snapshot repo.org.tld>
again, replacing
<repo.org.tld>
with your cvmfs-repository name. -
On one of the Client machines
Test that you can access the file with the command
/cvmfs/<repo.org.tld>/hello.sh
You can also run the following test commands on the client3 4.
cvmfs_config chksetup # should return OK cvmfs_config stat -v <repo.org.tld>
The output of the stat command should contain a line with the following
Connection: http://<STRATUM1_IP>/cvmfs/repo.organization.tld through proxy http://<PROXY_IP>:3128 (online)
-
This repository uses the Ansible Molecule framework for testing.
-
Install
pip
,ansible
, andpodman
. On Debian, they can all be installed withapt
.sudo apt install -y pip podman ansible
Otherwise, follow these instructions to install podman and molecule
-
Create a python environment that you can use from root.
python3 -m venv cvmfs sudo su . cvmfs/bin/activate pip install ansible molecule molecule-podman
-
While still acting as root, and in this directory, run
ansible-galaxy collection install . --force
-
Move into the
extensions
directorycd extensions/
-
Then, still as root, run
molecule test
to keep the test environment around after the tests are complete, you can instead run
molecule destroy && molecule test --destroy=never
Footnotes
-
https://cvmfs-contrib.github.io/cvmfs-tutorial-2021/02_stratum0_client/#216-adding-files-to-the-repository ↩
-
https://cvmfs-contrib.github.io/cvmfs-tutorial-2021/03_stratum1_proxies/#316-manually-synchronize-the-stratum-1 ↩
-
https://cvmfs-contrib.github.io/cvmfs-tutorial-2021/02_stratum0_client/#223-mounting-the-repositories ↩
-
https://cvmfs-contrib.github.io/cvmfs-tutorial-2021/03_stratum1_proxies/#333-test-the-new-configuration ↩