Skip to content

Commit 526bd39

Browse files
committed
update meta info of a given repo
1 parent caa0675 commit 526bd39

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
- name: Create temporary file for storing json
3+
ansible.builtin.tempfile:
4+
state: file
5+
suffix: .json
6+
register: tmp_json_file
7+
8+
- name: Add meta information for repository to temporary json file
9+
ansible.builtin.copy:
10+
content: "{{ cvmfs_repo_meta | combine(this_cvmfs_repo_meta) | to_nice_json(indent=2, sort_keys=false) }}"
11+
dest: "{{ tmp_json_file.path }}"
12+
mode: 0644
13+
14+
- name: Calculate the checksum of the json file
15+
ansible.builtin.stat:
16+
path: "{{ tmp_json_file.path }}"
17+
register: json_file_stat
18+
19+
- name: Get the current meta information of this repository from the server
20+
ansible.builtin.command:
21+
cmd: "cvmfs_swissknife info -M -r {{ this_cvmfs_repo_meta['recommended-stratum0'] }}"
22+
changed_when: false
23+
register: current_repo_meta
24+
25+
- name: Update the repository's meta information
26+
ansible.builtin.command:
27+
cmd: "cvmfs_server update-repoinfo -f {{ tmp_json_file.path }} {{ this_cvmfs_repo.repository }}"
28+
when: (current_repo_meta.stdout | checksum) != json_file_stat.stat.checksum
29+
become_user: "{{ cvmfs_repo_owner }}"
30+
31+
- name: Remove temporary json file
32+
ansible.builtin.file:
33+
path: "{{ tmp_json_file.path }}"
34+
state: absent
35+
...

0 commit comments

Comments
 (0)