Skip to content
Snippets Groups Projects
install-repair-tools.yml 3.80 KiB
---
- name: configure Debian repositories
  block:
    - name: öffentlichen Schlüssel hinzufügen (sonst muss bei jeder Installation eine Warnmeldung bestätigt werden)
      ansible.builtin.apt_key:
        url: "{{ vault_debrepo_url }}deb-repository/pub.gpg.key"
        state: present
      when: ansible_distribution_major_version == '11'
      tags: [apt, aptkey]
    - name: SLUB-lokales Debian-Repository für Installation der SubApp in /etc/apt/sources.list.d/ eintragen
      ansible.builtin.apt_repository:
        repo: "deb {{ vault_debrepo_url }}deb-repository bullseye main"
        state: present
        update_cache: "yes"
        mode: "0644"
      when: ansible_distribution_major_version == '11'
      tags: [apt]
  when: "ansible_facts['distribution'] == 'Debian'"

- name: cleanup legacy tools
  ansible.builtin.file:
    path: "{{ item }}"
    state: absent
  loop:
    - "/usr/local/bin/checkit_tiff"
    - "/usr/local/bin/fixit_tiff"
    - "/home/{{ vault_service_user }}/.cache/SLUB_LZA_Reparaturtool.cache"
    - "/etc/cit_tiff6_baseline_SLUB.cfg"
  notify: restart repairtools

- name: install repairtool dependencies from local Debian repo server
  ansible.builtin.apt:
    name: [
      '{{ item.package_name }}={{ item.version }}',
    ]
    # CAUTION!!! Always use "state: present". Due to version constraints, we do
    #            not allow just any package version or automatic update
    #            mechanisms. Autoupdates will make the repair tool crash!
    state: present
  loop: "{{ tool_versions_local }}"
  tags: [apt, no-ci]

- name: install repairtool (package dependencies are encoded in the package)
  ansible.builtin.apt:
    name: [
      '{{ item.package_name }}={{ item.version }}',
    ]
    # CAUTION!!! Always use "state: present". Due to version constraints, we do
    #            not allow just any package version or automatic update
    #            mechanisms. Autoupdates will make the repair tool crash!
    state: present
  loop: "{{ tool_versions_public }}"
  tags: [apt]

- name: configure tool version pinning to avoid automatic nightly upgrades
  ansible.builtin.template:
    src: "etc/apt/preferences.d/pinning.j2"
    dest: "/etc/apt/preferences.d/{{ item.package_name }}"
    owner: "root"
    group: "root"
    mode: "750"
  loop: "{{ tool_versions }}"

# FHS 3.0 specifies the correct path for the config:
# https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s09.html
- name: find checkit_tiff configs
  ansible.builtin.find:
    paths: "/usr/share/checkit_tiff_upcoming/example_configs/"
    patterns: '*.cfg'
  register: cit_configs