Skip to content

Commit a827ac9

Browse files
committed
initial commit from gitlab
0 parents  commit a827ac9

File tree

14 files changed

+348
-0
lines changed

14 files changed

+348
-0
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Role Name
2+
=========
3+
4+
This role configures a general-purpose CVMFS client on RPM-based systems.
5+
Refer to https://cernvm.cern.ch/portal/filesystem for more general information on CVMFS.
6+
Refer to [Accessing CVMFS](https://docs.computecanada.ca/wiki/Accessing_CVMFS) for more information on Compute Canada CVMFS.
7+
8+
Role Configuration
9+
--------------
10+
11+
See [defaults/main.yml](defaults/main.yml).
12+
13+
14+
Author Information
15+
------------------
16+
17+
Provided by Compute Canada under the GPLv2 license.
18+
19+
20+
Example playbook
21+
----------------
22+
23+
```
24+
---
25+
26+
- hosts: my_nodes
27+
roles:
28+
- ansible-cvmfs-client
29+
vars:
30+
cvmfs_cache_size: "40000"
31+
cvmfs_http_proxy: "http://cache1.example.org:3128|http://cache2.example.org:3128"
32+
become: yes
33+
become_user: root
34+
35+
```

defaults/main.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
3+
### Settings for Ansible role
4+
5+
# Which configuration domains to set up. Possible values include the following:
6+
# cvmfs-config-default - sets up EGI, OSG and CERN repositories
7+
# cvmfs-config-computecanada - sets up Compute Canada repositories
8+
cvmfs_configuration:
9+
- "cvmfs-config-default"
10+
# - "cvmfs-config-computecanada"
11+
12+
# If cvmfs_gid and cvmfs_uid are both defined, then Ansible will ensure that a 'cvmfs'
13+
# account with those ids is present before CVMFS is installed. You should make sure to do
14+
# this when deploying CVMFS on a cluster, in case an alien cache might be used.
15+
# cvmfs_gid: "8000131"
16+
# cvmfs_uid: "13000004"
17+
18+
# Whether to set up and use autofs to mount CVMFS repositories (recommended for standard deployment scenarios).
19+
# If false, static mounts will be configured instead (may be necessary for some container engines to use CVMFS).
20+
# Switching a client system from autofs to static mode requires some manual operations and is not supported by this Ansible role.
21+
cvmfs_auto_setup: true
22+
23+
# Set to true (only as a one-time option with -e) to switch from static mode to autofs. Will unmount all repos!
24+
cvmfs_force_unmount: false
25+
26+
# See `man autofs.conf`
27+
#cvmfs_autofs_timeout: 300
28+
29+
# Whether to configure a PV/VG/LV and filesystem for the CVMFS cache,
30+
# according to cvmfs_client_pv_name, cvmfs_client_vg_name, and
31+
# cvmfs_client_lv_name as described below. If false, you will need to
32+
# configure the cache storage yourself instead, and also ensure it is the required size.
33+
cvmfs_client_configure_storage: true
34+
35+
# If this block device name is defined, then a volume group, logical volume, and filesystem will be created on it.
36+
# If it is not defined, then a volume group is assumed to already exist and will be used instead.
37+
# In either case, the name of the volume group is given by cvmfs_client_vg_name.
38+
#cvmfs_client_pv_name: "vdb"
39+
40+
# Name of the volume group for the CVMFS local cache filesystem.
41+
cvmfs_client_vg_name: "cvmfsvg"
42+
43+
# Name of the logical volume for the CVMFS local cache filesystem.
44+
cvmfs_client_lv_name: "cvmfs"
45+
46+
### Settings for CVMFS client
47+
# For further details on CVMFS client configuration settings refer to:
48+
# https://cvmfs.readthedocs.io/en/stable/apx-parameters.html
49+
# https://cvmfs.readthedocs.io/en/stable/cpt-configure.html
50+
51+
# Size of the local cache filesystem in megabytes. The cache usage quota (CVMFS_QUOTA_LIMIT) will be automatically
52+
# set to ~ 85% of this amount, to allow for momentary usage beyond the quota while cache clean-up is in progress.
53+
cvmfs_cache_size: "50000"
54+
55+
# The list of repositories that will be accessible. CVMFS_STRICT_MOUNT is enabled so this IS
56+
# an exclusive list; your inventory must include any additional repositories you wish to use.
57+
# In particular cvmfs-config.computecanada.ca is required for other Compute Canada repositories to function.
58+
cvmfs_repositories:
59+
- "soft.computecanada.ca"
60+
- "cvmfs-config.computecanada.ca"
61+
62+
# The list of caching proxy servers to use.
63+
# For more info see
64+
# https://docs.computecanada.ca/wiki/Accessing_CVMFS
65+
# https://cvmfs.readthedocs.io/en/stable/cpt-configure.html#proxy-lists
66+
cvmfs_http_proxy: "DIRECT"
67+
68+
# This dict allows arbitrary CVMFS client settings to be applied in /etc/cvmfs/default.local .
69+
# Use this to apply any other settings, aside from those already defined by
70+
# other variables (CVMFS_REPOSITORIES, CVMFS_QUOTA_LIMIT, CVMFS_HTTP_PROXY).
71+
# For example:
72+
# cvmfs_client_conf:
73+
# CVMFS_INSTRUMENT_FUSE: "true"
74+
cvmfs_client_conf: {}

handlers/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
# handlers file for ansible-cvmfs-client

meta/main.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
galaxy_info:
2+
author: Compute Canada CVMFS Team
3+
description: CVMFS client role
4+
company: Compute Canada
5+
6+
# If the issue tracker for your role is not on github, uncomment the
7+
# next line and provide a value
8+
# issue_tracker_url: http://example.com/issue/tracker
9+
10+
# Some suggested licenses:
11+
# - BSD (default)
12+
# - MIT
13+
# - GPLv2
14+
# - GPLv3
15+
# - Apache
16+
# - CC-BY
17+
license: GPLv3
18+
19+
min_ansible_version: 2.4
20+
21+
# If this a Container Enabled role, provide the minimum Ansible Container version.
22+
# min_ansible_container_version:
23+
24+
# Optionally specify the branch Galaxy will use when accessing the GitHub
25+
# repo for this role. During role install, if no tags are available,
26+
# Galaxy will use this branch. During import Galaxy will access files on
27+
# this branch. If Travis integration is configured, only notifications for this
28+
# branch will be accepted. Otherwise, in all cases, the repo's default branch
29+
# (usually master) will be used.
30+
#github_branch:
31+
32+
#
33+
# Provide a list of supported platforms, and for each platform a list of versions.
34+
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
35+
# To view available platforms and versions (or releases), visit:
36+
# https://galaxy.ansible.com/api/v1/platforms/
37+
#
38+
# platforms:
39+
# - name: Fedora
40+
# versions:
41+
# - all
42+
# - 25
43+
# - name: SomePlatform
44+
# versions:
45+
# - all
46+
# - 1.0
47+
# - 7
48+
# - 99.99
49+
platforms:
50+
- name: EL
51+
versions:
52+
- 6
53+
- 7
54+
55+
galaxy_tags: []
56+
# List tags for your role here, one per line. A tag is a keyword that describes
57+
# and categorizes the role. Users find roles by searching for tags. Be sure to
58+
# remove the '[]' above, if you add tags to this list.
59+
#
60+
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
61+
# Maximum 20 tags per role.
62+
63+
dependencies: []
64+
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
65+
# if you add dependencies to this list.

tasks/config.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
3+
# TODO: this task could be improved by detecting if default.local changes and doing a config reload if needed.
4+
- name: Set up default.local configuration file
5+
template:
6+
src: "default.local.j2"
7+
dest: "/etc/cvmfs/default.local"
8+
owner: "root"
9+
group: "root"
10+
mode: "0644"
11+
12+
- name: Set autofs timeout
13+
ansible.builtin.lineinfile:
14+
path: /etc/autofs.conf
15+
regex: "^timeout"
16+
line: "timeout = {{ cvmfs_autofs_timeout }}"
17+
when: cvmfs_autofs_timeout is defined
18+
19+
# Use 'nofail' in options so that the system can still boot if there is a problem with a CVMFS repo.
20+
# Some health checks (e.g. cvmfs_config probe) should be used to confirm that each repository is available when needed.
21+
- name: Set up static repository mounts
22+
mount:
23+
path: "/cvmfs/{{ item }}"
24+
fstype: "cvmfs"
25+
src: "{{ item }}"
26+
opts: "defaults"
27+
state: "{% if not cvmfs_auto_setup %}mounted{% elif cvmfs_force_unmount %}absent{% endif %}"
28+
when: (not cvmfs_auto_setup) or (cvmfs_force_unmount)
29+
loop: "{{ cvmfs_repositories }}"

tasks/keys.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
3+
# The CERNVM GPG key is the trust anchor for the secure installation of the CVMFS client.
4+
#
5+
# The Compute Canada CVMFS GPG key is the trust anchor for the secure distribution of the Compute Canada software stack (and other content), as follows:
6+
# - the Compute Canada CVMFS GPG key verifies the authenticity of the computecanada-release RPM
7+
# - the computecanada-release RPM configures a yum repository which distributes the cvmfs-config-computecanada RPM
8+
# - the cvmfs-config-computecanada RPM contains the public CVMFS key for the cvmfs-config.computecanada.ca CVMFS configuration repository
9+
# - the CVMFS configuration repository contains the public CVMFS keys for all other Compute Canada CVMFS repositories
10+
# - the other CVMFS repositories contain all Compute Canada software (and other content)
11+
12+
- name: Install CernVM GPG key
13+
rpm_key:
14+
key: https://cvmrepo.web.cern.ch/cvmrepo/yum/RPM-GPG-KEY-CernVM
15+
state: present
16+
validate_certs: yes
17+
fingerprint: "70B9 8904 8820 8E31 5ED4 5208 230D 389D 8AE4 5CE7"
18+
19+
# Also available at https://git.computecanada.ca/cc-cvmfs-public/cvmfs-config/raw/master/RPM-GPG-KEY-CC-CVMFS-1
20+
- name: Install Compute Canada CVMFS GPG key
21+
rpm_key:
22+
key: https://package.computecanada.ca/yum/cc-cvmfs-public/RPM-GPG-KEY-CC-CVMFS-1
23+
state: present
24+
validate_certs: yes
25+
fingerprint: "C0C4 0F04 70A3 6AF2 7CC4 4D5A 3B9F C55A CF21 4CFC"
26+
when: '"cvmfs-config-computecanada" in cvmfs_configuration'

tasks/main.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
3+
- name: Gather package facts
4+
package_facts:
5+
check_mode: no
6+
tags:
7+
- yum
8+
9+
- { import_tasks: keys.yml, tags: ['keys'] }
10+
- { import_tasks: yum.yml, tags: ['yum'] }
11+
- { import_tasks: users.yml, tags: ['users'] }
12+
- { import_tasks: storage.yml, tags: ['storage'], when: cvmfs_client_configure_storage | bool }
13+
- { import_tasks: packages.yml, tags: ['packages'] }
14+
- { import_tasks: config.yml, tags: ['config'] }
15+
- { import_tasks: test.yml, tags: ['test'] }
16+

tasks/packages.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
3+
- name: Install CVMFS client and configuration packages
4+
yum:
5+
name: "['cvmfs'] + {{ cvmfs_auto_setup_package }} + {{ cvmfs_configuration }}"
6+
vars:
7+
cvmfs_auto_setup_package: "{{ ['cvmfs-auto-setup'] if cvmfs_auto_setup|bool else [] }}"

tasks/storage.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
3+
- name: Create volume group for CVMFS cache
4+
lvg: pvs="/dev/{{ cvmfs_client_pv_name }}" vg="{{ cvmfs_client_vg_name }}"
5+
when: cvmfs_client_pv_name is defined
6+
7+
- name: Create logical volume for CVMFS cache
8+
lvol: vg="{{ cvmfs_client_vg_name }}" lv="{{ cvmfs_client_lv_name }}" size="{{ cvmfs_cache_size }}M"
9+
10+
- name: Create filesystem for CVMFS cache
11+
filesystem: dev="/dev/mapper/{{ cvmfs_client_vg_name }}-{{ cvmfs_client_lv_name }}" fstype=ext4 resizefs=yes
12+
13+
- name: Mount CVMFS cache filesystem and add to /etc/fstab
14+
mount: name=/var/lib/cvmfs src="/dev/mapper/{{ cvmfs_client_vg_name }}-{{ cvmfs_client_lv_name }}" state=mounted fstype=ext4 passno=2
15+

tasks/test.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
3+
# TODO improve this: it may print warnings, but the output is not shown
4+
- name: CVMFS check setup
5+
command: /usr/bin/cvmfs_config chksetup
6+
changed_when: false
7+
8+
- name: CVMFS probe
9+
command: /usr/bin/cvmfs_config probe
10+
changed_when: false
11+
check_mode: no
12+

0 commit comments

Comments
 (0)