-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathrepo_meta_info.yml
36 lines (31 loc) · 1.25 KB
/
repo_meta_info.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
- 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 http://localhost:{{ cvmfs_stratum0_http_ports[0] | default('80') }}/cvmfs/{{ this_cvmfs_repo.repository }}"
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: true
become_user: "{{ cvmfs_repo_owner | default('root') }}"
- name: Remove temporary json file
ansible.builtin.file:
path: "{{ tmp_json_file.path }}"
state: absent
...