Select Git revision
install_validation_tools.yml 6.47 KiB
---
- name: install validation dependencies from SLUB Debian repo
ansible.builtin.package:
name: [
"git",
"inotify-tools",
# "checkit-tiff-current", # This is no longer used, because we only want to validate against upcoming. It stays here for documentation purposes.
"checkit-tiff-upcoming",
"libzen0v5",
"libmediainfo0v5",
"iccmax", # Icc-Tools, installed from SLUBs private package repo
"mediaconch",
"xsltproc",
]
# CAUTION:
# Do NOT use "state: latest", because the repair tools might need specific
# versions of these tools!
state: present
# KEEP THIS HERE!
# This is in preparation for when the tools actually become available for use on the repair server.
# - name: create directories for validation dependencies from Gitlab-CI server
# ansible.builtin.file:
# path: "/usr/share/XmlFormatValidationPlugin/"
# state: directory
# mode: "0755"
# - name: install validation dependencies from Gitlab-CI server
# ansible.builtin.get_url:
# url: "https://git.slub-dresden.de/digital-preservation/xml_plugin4rosetta/-/releases/permalink/latest/downloads/binaries/XmlFormatValidationPlugin.jar"
# dest: "/usr/share/XmlFormatValidationPlugin/"
# mode: "0644"
- name: remove existing MediaConch-Profile repo directory (otherwise, we can't clone it in the next task -.-)
ansible.builtin.file:
path: "/tmp/mediaconch-profile/"
state: absent
changed_when: false # there's no other way to get this task idempotent
- name: checkout MediaConch-Profile repo
ansible.builtin.git:
repo: "https://git.slub-dresden.de/digital-preservation/mediaconch-profile.git"
dest: "/tmp/mediaconch-profile/"
register: mc_profile_repo_cloned
changed_when: false # there's no other way to get this task idempotent
- name: compile MediaConch profile
ansible.builtin.command:
cmd: "bash ./build_all.sh"
chdir: "/tmp/mediaconch-profile/"
when: mc_profile_repo_cloned.before != mc_profile_repo_cloned.after
register: mc_profile_repo_built
changed_when: false # there's no other way to get this task idempotent
- name: deploy MediaConch profile to Rosetta
ansible.builtin.copy:
src: "/tmp/mediaconch-profile/build/SLUB_mediaconch_policy_all.xml"
dest: "/usr/local/etc/SLUB_mediaconch_policy_all.xml"
remote_src: true
mode: "0644"
# According to FHS 3.0 (https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s09.html),
# use "/usr/local/etc/" for "Host-specific system configuration for local binaries".
# As our config files are shareable according to https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch02.html,
# we place them below "/usr/" instead of "/etc/".
- name: create symlinks for validation tool profiles
ansible.builtin.file:
src: "{{ item.s | default(omit) }}" # file to link to
dest: "/usr/local/etc/{{ item.d }}" # symlink file path
state: "{{ item.state | default('link') }}"
mode: "{{ item.m | default(omit) }}"
loop:
# TIFF 6
- d: "cit_tiff6_baseline_SLUB_current.cfg"
state: "absent"
- s: "/usr/share/checkit_tiff_upcoming/example_configs/cit_tiff6_baseline_SLUB.cfg"
d: "cit_tiff6_baseline_SLUB_upcoming.cfg"
# GeoTIFF 6
- d: "cit_tiff6_geotiff_SLUB_current.cfg"
state: "absent"
- s: "/usr/share/checkit_tiff_upcoming/example_configs/cit_tiff6_geotiff_SLUB.cfg"
d: "cit_tiff6_geotiff_SLUB_upcoming.cfg"
# Retrofotos Fotothek
- d: "cit_tiff_retrofotos_SLUB_current.cfg"
state: "absent"
- s: "/usr/share/checkit_tiff_upcoming/example_configs/cit_tiff_retrofotos_SLUB.cfg"
d: "cit_tiff_retrofotos_SLUB_upcoming.cfg"
- name: install validation tool
ansible.builtin.apt:
name: "validate-workflows"
state: latest
install_recommends: true
# - name: create validation directories
# ansible.builtin.file:
# path: "{{ item }}"
# state: directory
# mode: "0777" # it's created in a mixed mode NFS/CIFS share, so mode will always be 0777, no matter what we set
# owner: "lza"
# group: "aw_lza_repair"
# loop:
# - "/mnt/lza_repair_ddz/validate/unchecked/"
# - "/mnt/lza_repair_ddz/validate/results/"
# - "/mnt/lza_repair_digas/validate/unchecked/"
# - "/mnt/lza_repair_digas/validate/results/"
# - "/mnt/lza_repair_fotothek/validate/unchecked/"
# - "/mnt/lza_repair_fotothek/validate/results/"
# - "/mnt/lza_repair_mediathek/validate/unchecked/"
# - "/mnt/lza_repair_mediathek/validate/results/"
# - "/mnt/lza_repair_save/validate/unchecked/"
# - "/mnt/lza_repair_save/validate/results/"
# man 5 systemd.unit, table "Unit File Load Path"
- name: create Systemd unit directory in Unit File Load Path
ansible.builtin.file:
path: "/usr/local/lib/systemd/system/"
state: directory
mode: "0755"
- name: install validation service units and sockets
ansible.builtin.template:
src: "usr/local/lib/systemd/system/{{ item }}.j2"
dest: "/usr/local/lib/systemd/system/{{ item }}"
mode: "0640"
owner: "root"
group: "root"
loop:
- "cleanup_daemon_@.service"
- "cleanup_daemon_@.timer"
- "validation_daemon_any@.service"
- "validation_daemon_any.socket"
- "validation_daemon_@.service" # Daemon service
notify: systemctl daemon-reload
- name: enable & start validation daemon
ansible.builtin.systemd:
name: "validation_daemon_@{{ item }}.service"
daemon_reload: true
enabled: true
state: restarted # this can never be idempotent
loop:
- "ddz"
- "digas"
- "fotothek"
- "mediathek"
- "save"
changed_when: false
- name: enable & start cleanup daemon
ansible.builtin.systemd_service:
unit: "cleanup_daemon{{ item.u }}"
daemon_reload: true
enabled: "{{ item.e | default(true) }}"
state: "{{ item.s | default(omit) }}" # this can never be idempotent
loop:
# Timers...
- u: "_@ddz.timer"
s: "restarted"
- u: "_@digas.timer"
s: "restarted"
- u: "_@fotothek.timer"
s: "restarted"
- u: "_@mediathek.timer"
s: "restarted"
- u: "_@save.timer"
s: "restarted"
# ... and their respective services
- u: "_@ddz.service"
- u: "_@digas.service"
- u: "_@fotothek.service"
- u: "_@mediathek.service"
- u: "_@save.service"
changed_when: false
- name: enable & start validation Webservice
ansible.builtin.systemd:
name: "validation_daemon_any.{{ item }}"
daemon_reload: true
enabled: true
state: restarted # this can never be idempotent
loop:
- "socket"
changed_when: false