Skip to content
Snippets Groups Projects
install_validation_tools.yml 5.84 KiB
---
- name: install validation dependencies from SLUB Debian repo
  ansible.builtin.package:
    name: [
      "git",
      "inotify-tools",
#      "checkit-tiff-current",
      "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

- 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 }}"     # file to link to
    dest: "/usr/local/etc/{{ item.d }}"    # symlink file path
    state: link
  loop:
    # TIFF 6
    - s: "/usr/share/checkit_tiff_current/example_configs/cit_tiff6_baseline_SLUB.cfg"
      d: "cit_tiff6_baseline_SLUB_current.cfg"
    - s: "/usr/share/checkit_tiff_upcoming/example_configs/cit_tiff6_baseline_SLUB.cfg"
      d: "cit_tiff6_baseline_SLUB_upcoming.cfg"
    # GeoTIFF 6
    - s: "/usr/share/checkit_tiff_current/example_configs/cit_tiff6_geotiff_SLUB.cfg"
      d: "cit_tiff6_geotiff_SLUB_current.cfg"
    - s: "/usr/share/checkit_tiff_upcoming/example_configs/cit_tiff6_geotiff_SLUB.cfg"
      d: "cit_tiff6_geotiff_SLUB_upcoming.cfg"
    # Retrofotos Fotothek
    - s: "/usr/share/checkit_tiff_current/example_configs/cit_tiff_retrofotos_SLUB.cfg"
      d: "cit_tiff_retrofotos_SLUB_current.cfg"