Skip to content

Commit acf49af

Browse files
authored
Merge pull request #1 from bedroge/master
First versions of Ansible playbooks that seem to work
2 parents c55676a + 5c4087b commit acf49af

File tree

13 files changed

+239
-2
lines changed

13 files changed

+239
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hosts

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "roles/galaxyproject.cvmfs"]
2+
path = roles/cvmfs
3+
url = https://github.com/galaxyproject/ansible-cvmfs

README.md

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,48 @@
1-
# CVMFS-layer
2-
CVMFS layer of EESSI project
1+
# CVMFS layer
2+
3+
## Introduction
4+
The EESSI project uses the CernVM File System (CVMFS) for distributing its software. More details about CVMFS can be found at its homepage and documentation:
5+
6+
- http://cernvm.cern.ch/portal/filesystem
7+
- https://cvmfs.readthedocs.io
8+
9+
The following introductory video on Youtube gives a quite good overview of CVMFS as well:
10+
https://www.youtube.com/playlist?list=FLqCLabkRddpbHj4wYNFYjAA
11+
12+
## CVMFS infrastructure
13+
14+
The CVMFS layer of the EESSI project consists of the usual CVMFS infrastructure:
15+
* one Stratum 0 server;
16+
* multiple Stratum 1 servers, which contain replicas of the Stratum 0 repositories;
17+
* multiple local Squid proxy servers;
18+
* CVMFS clients with the appropriate configuration files on all the machines that need access to the CVMFS repositories.
19+
20+
## Installation and configuration
21+
22+
For the installation of all components we make use of the Ansible files provided by the Galaxy project:
23+
https://github.com/galaxyproject/ansible-cvmfs
24+
This repository is added as a submodule inside the roles directory, so make sure to use the --recursive options when cloning this repository:
25+
```
26+
git clone --recursive git@github.com:EESSI/cvmfs-layer.git
27+
```
28+
Alternatively, clone this repository first, and init and update the required submodule later:
29+
```
30+
git clone git@github.com:EESSI/cvmfs-layer.git
31+
cd cvmfs-layer/roles/cvmfs/
32+
git submodule init
33+
git submodule update
34+
```
35+
For more information about (working with) submodules, see:
36+
https://git-scm.com/book/en/v2/Git-Tools-Submodules
37+
38+
The EESSI specific settings can be found in group_vars/all.yml, and in templates we added a template for a Squid configation for the local proxy servers; this file is not included in the Galaxy repository.
39+
40+
In order to run one of these playbooks, you will have to use a hosts file that includes at least the group of nodes for which you are running a playbook. An example of the file that shows the correct structure can be found in hosts.example.
41+
The playbooks can then be run as follows:
42+
```
43+
ansible-playbook -i hosts -b <name of playbook>.yml
44+
```
45+
where -b means become, i.e. run with sudo. If this requires a password, include -K:
46+
```
47+
ansible-playbook -i hosts -b -K <name of playbook>.yml
48+
```

client.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- name: CVMFS
2+
hosts: cvmfsclients
3+
vars:
4+
eessi_cvmfs_repos_enabled: config-repo
5+
roles:
6+
- cvmfs

group_vars/all.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
# vars file for eessi project
3+
4+
# The license key for the Geo API:
5+
# https://cvmfs.readthedocs.io/en/stable/cpt-replica.html#geo-api-setup
6+
# For some unclear reason, the Stratum 1 installation fails when this is not set:
7+
# https://github.com/EESSI/cvmfs-layer/issues/2
8+
#cvmfs_geo_license_key:
9+
10+
# Automatically configure EESSI CVMFS repos
11+
eessi_cvmfs_repos_enabled: config-repo
12+
13+
# Email address for the project, which will be put in the contact file on the config repo.
14+
eessi_email: eessi@list.rug.nl
15+
16+
# Defaults for eessi-hpc.org config repo, syntax for each key is the same as that of cvmfs_<key | pluralize>
17+
eessi_cvmfs_config_repo:
18+
domain: eessi-hpc.org
19+
key:
20+
path: /etc/cvmfs/keys/eessi-hpc.org/cvmfs-config.eessi-hpc.org.pub
21+
key: |
22+
-----BEGIN PUBLIC KEY-----
23+
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqoTBc/Eksr9ECEOoCzHA
24+
F20UjePR7mJyWB13eTBXnjq7PLKKilfk2llLKetPIRMEmbvp97NiQ9ALe/tiGDzT
25+
1Wg82Mf9oO4DNQYrTfE/MP5inIrMtSv1WnYJYV4Bgm24s8IhHXytIf1D4qt0x1v5
26+
0yRui0dwaZrErWKRKufbJ6ehmEDHuVSEAujrORyig/jYFKVyTaCsXnmwFDJmX2Uw
27+
RGCaf0M9ZLYs9t/SWA0s08rle5kH82hgBsIvUr7PLT7hbU407VK6+Y02tuxbI0JR
28+
+hCt494UsFs3tchmTebpK+x3pVRXybQ66Qm1mQiaz+2VbUJdQEov4RCC5PcOmOOk
29+
BwIDAQAB
30+
-----END PUBLIC KEY-----
31+
urls:
32+
- "http://cvmfs-s1-rug.eessi-hpc.org/cvmfs/@fqrn@"
33+
repository:
34+
repository: cvmfs-config.eessi-hpc.org
35+
stratum0: cvmfs-s0.eessi-hpc.org
36+
owner: "{{ cvmfs_repo_owner | default('root') }}"
37+
server_options: []
38+
client_options: []
39+
40+
# Defaults for eessi-hpc.org repos
41+
eessi_cvmfs_keys:
42+
- path: /etc/cvmfs/keys/eessi-hpc.org/pilot.eessi-hpc.org.pub
43+
key: |
44+
-----BEGIN PUBLIC KEY-----
45+
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAommtaoqQ36Rb/cFnqUWg
46+
8FoYCOjJWVBMQ4sVZ87oFRWehOUbcfy/ah85D9055HQws7i/hLNGJJAa7Es3E2o8
47+
v8LtSlRdfR1A7b7LA6p3213HHz6dNU6I1riwtE2OP7/w4Q3+Agj1iRtW535GwzGo
48+
4ZbewL8T1kbyaEm4HyefoitHXJthoPyTlYAhvAegIil1VJPhJZW+q/NWxnsd9QGJ
49+
uAtbSICQg6mBJI50KiCBYmKHOAjH2W8qEnLWc7JoPoNvAHuMx1ya6YerBM5T9Esm
50+
HJN0HHOVdRIwNjjPkV2jIqhJoI85no89v8/V45SFPVo+A7N0Cj4QdQrQTezpnlby
51+
FQIDAQAB
52+
-----END PUBLIC KEY-----
53+
54+
eessi_cvmfs_server_urls:
55+
- domain: eessi-hpc.org
56+
use_geoapi: true
57+
urls:
58+
- "http://cvmfs-s1-rug.eessi-hpc.org/cvmfs/@fqrn@"
59+
60+
eessi_cvmfs_repositories:
61+
- repository: pilot.eessi-hpc.org
62+
stratum0: cvmfs-s0.eessi-hpc.org
63+
owner: "{{ cvmfs_repo_owner | default('root') }}"
64+
key_dir: /etc/cvmfs/keys/eessi-hpc.org
65+
server_options:
66+
- CVMFS_AUTO_GC=false
67+
- CVMFS_GARBAGE_COLLECTION=true
68+
- CVMFS_AUTO_GC=false
69+
client_options:
70+
- CVMFS_NFILES=4096
71+
72+
# Override all the Galaxy defaults by our EESSI defaults.
73+
# This is required, beucase the galaxy_* variables are used inside the Ansible tasks.
74+
galaxy_cvmfs_config_repo: "{{ eessi_cvmfs_config_repo }}"
75+
galaxy_cvmfs_keys: "{{ eessi_cvmfs_keys }}"
76+
galaxy_cvmfs_server_urls: "{{ eessi_cvmfs_server_urls }}"
77+
galaxy_cvmfs_repositories: "{{ eessi_cvmfs_repositories }}"
78+
galaxy_cvmfs_repos_enabled: "{{ eessi_cvmfs_repos_enabled }}"

hosts.example

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[cvmfsstratum0servers]
2+
your-stratum0.org
3+
4+
[cvmfsstratum1servers]
5+
your-stratum1.org
6+
7+
[cvmfslocalproxies]
8+
your-proxy-1
9+
your-proxy-2
10+
11+
[cvmfsclients]
12+
your-client-1
13+
your-client-2
14+
15+
[cvmfsclients:vars]
16+
cvmfs_http_proxies=["your-proxy-1:3128", "your-proxy-2:3128"]
17+
18+

localproxy.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- name: CVMFS
2+
hosts: cvmfslocalproxies
3+
roles:
4+
- cvmfs

roles/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This roles directory contains a submodule that points to the repository of the Galaxy Ansible role for installing/configuring CVMFS, which can be found at:
2+
https://github.com/galaxyproject/ansible-cvmfs
3+
4+
We renamed the directory to "cvmfs", so we can use "cvmfs" as the name of this role in our Ansible playbooks.

roles/cvmfs

Submodule cvmfs added at 8f2efa6

stratum0-deploy-cvmfs-config.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Start a transaction on the Stratum 0 and put all the files for the config repo in place.
2+
# Note: first deploy your Stratum 0 and make sure that group_vars/all.yml contains the right configuration,
3+
# including all the keys of the repositories that have to be configured.
4+
---
5+
- name: CVMFS
6+
hosts: cvmfsstratum0servers
7+
tasks:
8+
- name: Start the CVMFS transaction, create directories, and copy files
9+
block:
10+
- name: start CVMFS transaction
11+
shell: cvmfs_server transaction "{{ eessi_cvmfs_config_repo.repository.repository }}"
12+
13+
- name: create directories
14+
file:
15+
path: "{{ item }}"
16+
state: directory
17+
with_list:
18+
- "/cvmfs/{{ eessi_cvmfs_config_repo.repository.repository }}/etc/cvmfs/keys/{{ eessi_cvmfs_config_repo.domain }}"
19+
- "/cvmfs/{{ eessi_cvmfs_config_repo.repository.repository }}/etc/cvmfs/contact"
20+
- "/cvmfs/{{ eessi_cvmfs_config_repo.repository.repository }}/etc/cvmfs/domain.d"
21+
22+
- name: deploy public keys
23+
copy: content="{{ item.key }}" dest="/cvmfs/{{ eessi_cvmfs_config_repo.repository.repository }}{{ item.path }}"
24+
with_items: "{{ eessi_cvmfs_keys }}"
25+
26+
- name: create contacts file
27+
copy: content="{{ eessi_email }}\n" dest="/cvmfs/{{ eessi_cvmfs_config_repo.repository.repository }}/etc/cvmfs/contact/{{ eessi_cvmfs_config_repo.domain }}"
28+
29+
- name: create domain configuration file
30+
copy:
31+
content: |
32+
CVMFS_SERVER_URL="{{ eessi_cvmfs_config_repo.urls | join(';') }}"
33+
CVMFS_KEYS_DIR="/cvmfs/{{ eessi_cvmfs_config_repo.repository.repository }}/etc/cvmfs/keys/{{ eessi_cvmfs_config_repo.domain }}"
34+
CVMFS_USE_GEOAPI="{{ eessi_cvmfs_server_urls[0].use_geoapi | default(false) | ternary('yes', 'no') }}"
35+
dest: "/cvmfs/{{ eessi_cvmfs_config_repo.repository.repository }}/etc/cvmfs/domain.d/{{ eessi_cvmfs_config_repo.domain }}.conf"
36+
37+
- name: create default CVMFS configuration file
38+
copy:
39+
content: |
40+
# For reference see https://sft.its.cern.ch/jira/browse/CVM-878
41+
CVMFS_LOW_SPEED_LIMIT=10000
42+
dest: "/cvmfs/{{ eessi_cvmfs_config_repo.repository.repository }}/etc/cvmfs/default.conf"
43+
44+
- name: publish CVMFS transaction
45+
shell: cvmfs_server publish "{{ eessi_cvmfs_config_repo.repository.repository }}"
46+
rescue:
47+
- name: cancel the transaction
48+
shell: cvmfs_server abort -f "{{ eessi_cvmfs_config_repo.repository.repository }}"

0 commit comments

Comments
 (0)