-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from bedroge/cvmfs_server_metadata
Add role for updating meta information of CVMFS servers and repositories
- Loading branch information
Showing
6 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
eessi_cvmfs_repos_enabled: true | ||
|
||
# Email address for the project. | ||
eessi_email: [email protected] | ||
eessi_email: [email protected] | ||
|
||
# | ||
# Defaults for eessi-hpc.org repos. | ||
|
@@ -87,6 +87,7 @@ eessi_cvmfs_repositories: | |
- CVMFS_GARBAGE_COLLECTION=true | ||
client_options: [] | ||
use_for_ci: false | ||
description: Repository containing pilot versions of the EESSI software stack. | ||
- repository: data.eessi-hpc.org | ||
stratum0: rug-nl.stratum0.cvmfs.eessi-infra.org | ||
owner: "{{ cvmfs_repo_owner | default('root') }}" | ||
|
@@ -97,6 +98,7 @@ eessi_cvmfs_repositories: | |
- CVMFS_GARBAGE_COLLECTION=true | ||
client_options: [] | ||
use_for_ci: false | ||
description: "Data files used for applications available in the EESSI stack." | ||
- repository: ci.eessi-hpc.org | ||
stratum0: rug-nl.stratum0.cvmfs.eessi-infra.org | ||
owner: "{{ cvmfs_repo_owner | default('root') }}" | ||
|
@@ -106,6 +108,15 @@ eessi_cvmfs_repositories: | |
- CVMFS_GARBAGE_COLLECTION=true | ||
client_options: [] | ||
use_for_ci: true | ||
description: "Small-sized repository used for CI purposes." | ||
|
||
# Meta information for CVMFS Stratum servers | ||
cvmfs_server_meta_administrator: "EESSI CVMFS Administrators" | ||
cvmfs_server_meta_email: "{{ eessi_email }}" | ||
cvmfs_server_meta_organisation: "EESSI" | ||
cvmfs_server_meta_custom: | ||
_comment: "See https://eessi.io/docs/ for more information about the EESSI repository." | ||
cvmfs_server_meta_website: "https://eessi.io" | ||
|
||
# Override all the Galaxy defaults by our EESSI defaults. | ||
# This is required, beucase the galaxy_* variables are used inside the Ansible tasks. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
cvmfs_server_meta: | ||
administrator: "{{ cvmfs_server_meta_administrator | default('Your Name') }}" | ||
email: "{{ cvmfs_server_meta_email | default('[email protected]') }}" | ||
organisation: "{{ cvmfs_server_meta_organisation | default('Your Organisation') }}" | ||
custom: "{{ cvmfs_server_meta_custom | default({'_comment': 'Put arbitrary structured data here'}) }}" | ||
|
||
cvmfs_repo_meta: | ||
administrator: "{{ cvmfs_server_meta_administrator | default('Your Name') }}" | ||
email: "{{ cvmfs_server_meta_email | default('[email protected]') }}" | ||
organisation: "{{ cvmfs_server_meta_organisation | default('Your Organisation') }}" | ||
description: "Repository content" | ||
url: "{{ cvmfs_server_meta_website | default('Project website') }}" | ||
recommended-stratum0: "stratum 0 url" | ||
recommended-stratum1s: ["stratum1 url", "stratum1 url"] | ||
|
||
custom: "{{ cvmfs_server_meta_custom | default({'_comment': 'Put arbitrary structured data here'}) }}" | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
- name: Create a meta.json containing the CVMFS Server Meta Information | ||
ansible.builtin.copy: | ||
content: "{{ cvmfs_server_meta | to_nice_json(indent=2, sort_keys=false) }}" | ||
dest: "{{ cvmfs_srv_mount }}/cvmfs/info/v1/meta.json" | ||
owner: root | ||
group: root | ||
mode: 0644 | ||
become: true | ||
|
||
- name: Create meta information for each CVMFS repository | ||
ansible.builtin.include_tasks: repo_meta_info.yml | ||
vars: | ||
this_cvmfs_repo: "{{ item }}" | ||
this_cvmfs_repo_meta: | ||
description: "{{ item.description | default(omit) }}" | ||
recommended-stratum0: "http://{{ item.stratum0 }}/cvmfs/{{ item.repository }}" | ||
recommended-stratum1s: "{{ eessi_cvmfs_server_urls | selectattr('domain', 'in', item.repository) | | ||
map(attribute='urls') | map('regex_replace', '@fqrn@', item.repository) }}" | ||
with_items: "{{ eessi_cvmfs_repositories }}" | ||
when: "'cvmfsstratum0servers' in group_names or cvmfs_role == 'stratum0'" | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
- name: Create temporary file for storing json | ||
ansible.builtin.tempfile: | ||
state: file | ||
suffix: .json | ||
register: tmp_json_file | ||
|
||
- name: Add meta information for repository to temporary json file | ||
ansible.builtin.copy: | ||
content: "{{ cvmfs_repo_meta | combine(this_cvmfs_repo_meta) | to_nice_json(indent=2, sort_keys=false) }}" | ||
dest: "{{ tmp_json_file.path }}" | ||
mode: 0644 | ||
|
||
- name: Calculate the checksum of the json file | ||
ansible.builtin.stat: | ||
path: "{{ tmp_json_file.path }}" | ||
register: json_file_stat | ||
|
||
- name: Get the current meta information of this repository from the server | ||
ansible.builtin.command: | ||
cmd: "cvmfs_swissknife info -M -r {{ this_cvmfs_repo_meta['recommended-stratum0'] }}" | ||
changed_when: false | ||
register: current_repo_meta | ||
|
||
- name: Update the repository's meta information | ||
ansible.builtin.command: | ||
cmd: "cvmfs_server update-repoinfo -f {{ tmp_json_file.path }} {{ this_cvmfs_repo.repository }}" | ||
when: (current_repo_meta.stdout | checksum) != json_file_stat.stat.checksum | ||
become_user: "{{ cvmfs_repo_owner }}" | ||
|
||
- name: Remove temporary json file | ||
ansible.builtin.file: | ||
path: "{{ tmp_json_file.path }}" | ||
state: absent | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters