Skip to content
Snippets Groups Projects
Commit 676a95fe authored by Jörg Sachse's avatar Jörg Sachse
Browse files

feat: implement Stichprobe 2.0 (aka. check_ie_sample) from ND-2346 & ND-2361

parent 05d38d68
No related branches found
No related tags found
No related merge requests found
Pipeline #2709 passed
......@@ -171,77 +171,64 @@
group: "{{ vault_subapp_group }}"
mode: "0644"
- name: Stichprobenpruefung Timer
- name: alte Stichproben entfernen
block:
# - name: Services disablen
# ansible.builtin.systemd:
# name: "{{ item }}"
# state: stopped
# enabled: false
# loop:
# - "stichprobe-daily-report.timer"
# - "stichprobe-daily-report.service"
# tags: [notest]
- name: Systemd-Units und Config entfernen
ansible.builtin.file:
path: "{{ item }}"
state: absent
loop:
- "/etc/systemd/user/stichprobe-daily-report.timer"
- "/etc/systemd/user/stichprobe-daily-report.service"
- "/home/{{ vault_subapp_user }}/.subapp/stichprobe.ini"
- name: check_ie_sample Timer
ansible.builtin.template:
src: "stichprobe-daily-report.timer.j2"
dest: "/etc/systemd/user/stichprobe-daily-report.timer"
src: "check_ie_sample.timer.j2"
dest: "/etc/systemd/user/check_ie_sample.timer"
owner: "root"
group: "root"
mode: "0644"
loop: "{{ lookup('dict', vault_stichprobe_hosts) }}"
loop: "{{ lookup('dict', vault_check_ie_sample_hosts) }}"
when: ansible_hostname == item.key
no_log: true
- name: Stichprobenpruefung Service
- name: check_ie_sample Service
ansible.builtin.template:
src: "stichprobe-daily-report.service.j2"
dest: "/etc/systemd/user/stichprobe-daily-report.service"
src: "check_ie_sample.service.j2"
dest: "/etc/systemd/user/check_ie_sample.service"
owner: "root"
group: "root"
mode: "0644"
loop: "{{ lookup('dict', vault_stichprobe_hosts) }}"
when: ansible_hostname == item.key
no_log: true
- name: Stichprobenprüfung Config
ansible.builtin.template:
src: "stichprobe.ini.j2"
dest: "/home/{{ vault_subapp_user }}/.subapp/stichprobe.ini"
owner: "{{ vault_subapp_user }}"
group: "{{ vault_subapp_user }}"
mode: "0600"
loop: "{{ lookup('dict', vault_stichprobe_hosts) }}"
loop: "{{ lookup('dict', vault_check_ie_sample_hosts) }}"
when: ansible_hostname == item.key
no_log: true
# - name: enable Stichprobe Services
# ansible.builtin.command: "systemctl enable /etc/systemd/user/stichprobe-daily-report.service" # noqa 303
# - name: enable check_ie_sample Service
# ansible.builtin.command: "systemctl enable /etc/systemd/user/check_ie_sample.service"
# loop: "{{ lookup('dict', vault_stichprobe_hosts) }}"
# when: ansible_hostname == item.key
# no_log: true
#
# - name: enable Stichprobe Timers
# ansible.builtin.command: "systemctl enable /etc/systemd/user/stichprobe-daily-report.timer" # noqa 303
# - name: enable check_ie_sample Timers
# ansible.builtin.command: "systemctl enable /etc/systemd/user/check_ie_sample.timer"
# loop: "{{ lookup('dict', vault_stichprobe_hosts) }}"
# when: ansible_hostname == item.key
# no_log: true
#
# - name: restart Stichprobe Timers
# - name: restart check_ie_sample Timers
# ansible.builtin.systemd:
# name: "stichprobe-daily-report.timer"
# name: "check_ie_sample.timer"
# state: restarted
# loop: "{{ lookup('dict', vault_stichprobe_hosts) }}"
# when: ansible_hostname == item.key
# ignore_errors: "yes"
# WORKAROUND: stopped until storage migration complete
- name: disable Stichprobe Services
ansible.builtin.command: "systemctl disable /etc/systemd/user/stichprobe-daily-report.service"
loop: "{{ lookup('dict', vault_stichprobe_hosts) }}"
when: ansible_hostname == item.key
no_log: true
# ignore_errors: true
- name: disable Stichprobe Timers
ansible.builtin.command: "systemctl disable /etc/systemd/user/stichprobe-daily-report.timer"
loop: "{{ lookup('dict', vault_stichprobe_hosts) }}"
when: ansible_hostname == item.key
no_log: true
# ignore_errors: true
- name: stop running Stichprobe Timers
ansible.builtin.systemd:
name: "stichprobe-daily-report.timer"
state: stopped
loop: "{{ lookup('dict', vault_stichprobe_hosts) }}"
when: ansible_hostname == item.key
# ignore_errors: true
# ignore_errors: true
......@@ -12,7 +12,7 @@
- "proxy.vault"
- "sftp.vault"
- "ssh_publickeys.vault"
- "stichprobe.vault"
- "check_ie_sample.vault"
- "subapp.vault"
- "users.vault"
tags: [always]
......
[Unit]
Description=service: daily report from stichprobe, institute {{ item.value.institute_name }}
Documentation={{ vault_stichprobe_docu_url }}
Documentation=perldoc /usr/local/bin/check_ie_sample.pl
[Service]
Type=oneshot
Restart=no
ExecStart=/usr/bin/perl -I /usr/local/perl /usr/local/bin/stichprobe.pl --config /home/{{ vault_subapp_user }}/.subapp/stichprobe.ini --daily --institute={{ item.value.institute_name }}
ExecStart=/usr/bin/perl -I /usr/local/perl /usr/local/bin/check_ie_sample.pl --institute {{ item.value.institute_name }} --email langzeitarchiv@slub-dresden.de --host {{ item.value.rosetta_host }} --user {{ item.value.user }} --password {{ item.value.password }} --sampling_factor 0.001
User={{ vault_subapp_user }}
Group={{ vault_subapp_group }}
......
[Unit]
Description=timer: daily report for stichprobe {{ item.value.institute_name }} workflows
Documentation={{ vault_stichprobe_docu_url }}
Documentation=perldoc /usr/local/bin/check_ie_sample.pl
[Timer]
#Run every day (daily ==> *-*-* 00:00:00)
#OnCalendar=daily
#Prevent Rosetta stress (4h ==> 14400s)
OnCalendar=monthly
#RandomizedDelaySec=14400
# run every x minutes/hours/days
OnUnitActiveSec={{ item.value.timer_interval }}
#OnUnitActiveSec={{ item.value.timer_interval }}
#Wake system from suspend mode
WakeSystem=true
#When activated, it triggers the service immediately if it missed the last start time, for example due to the system being powered off
......
# autentification
[host]
host = {{ item.value.host }}.{{ansible_domain}}
[user]
user = {{ item.value.user }}
[password]
password = {{ item.value.password }}
[email]
# The email address of the recipient. Add new addresses separated by a comma and a whitespace!
email = {{ item.value.email }}
[directory]
yearly_path = /tmp/yearly_checks
[institute]
# add new institutions separated by a comma and a whitespace!
name = {{ item.value.institute_name }}
code = {{ item.value.institute_code }}
dead_ref_process_id = {{ item.value.institute_dead_ref_process_id }}
fixity_check_process_id = {{ item.value.institute_fixity_check_process_id }}
department = {{ item.value.institute_department }}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment