diff --git a/tasks/install_subapp.yml b/tasks/install_subapp.yml index 3837f502f7f2eabec981185c53ea067bde014c4e..f703249bba94a222790c60c9474f4ac91c459cad 100644 --- a/tasks/install_subapp.yml +++ b/tasks/install_subapp.yml @@ -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 diff --git a/tasks/main.yml b/tasks/main.yml index 2907d1e274301c255c767942b6de40f4dd574465..a6ad0f2010cdedebd46f9798e87ad237df82d53f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -12,7 +12,7 @@ - "proxy.vault" - "sftp.vault" - "ssh_publickeys.vault" - - "stichprobe.vault" + - "check_ie_sample.vault" - "subapp.vault" - "users.vault" tags: [always] diff --git a/templates/check_ie_sample.service.j2 b/templates/check_ie_sample.service.j2 new file mode 100644 index 0000000000000000000000000000000000000000..c5d795ab80b980cdf6ed0c183a411a79cb02321b --- /dev/null +++ b/templates/check_ie_sample.service.j2 @@ -0,0 +1,13 @@ +[Unit] +Description=service: daily report from stichprobe, institute {{ item.value.institute_name }} +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/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 }} + +[Install] +WantedBy=default.target diff --git a/templates/stichprobe-daily-report.timer.j2 b/templates/check_ie_sample.timer.j2 similarity index 77% rename from templates/stichprobe-daily-report.timer.j2 rename to templates/check_ie_sample.timer.j2 index 94dfb9c73a53cd87e4084db6b1a415c41e13d1f7..94372a6f7320a7ce134f0683972789db1c28a4e8 100644 --- a/templates/stichprobe-daily-report.timer.j2 +++ b/templates/check_ie_sample.timer.j2 @@ -1,14 +1,12 @@ [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 diff --git a/templates/stichprobe-daily-report.service.j2 b/templates/stichprobe-daily-report.service.j2 deleted file mode 100644 index bf617f48d2aba10d66e643f471cce7fda7fe5bfd..0000000000000000000000000000000000000000 --- a/templates/stichprobe-daily-report.service.j2 +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=service: daily report from stichprobe, institute {{ item.value.institute_name }} -Documentation={{ vault_stichprobe_docu_url }} - -[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 }} -User={{ vault_subapp_user }} -Group={{ vault_subapp_group }} - -[Install] -WantedBy=default.target diff --git a/templates/stichprobe.ini.j2 b/templates/stichprobe.ini.j2 deleted file mode 100644 index f384482b9fa133bf152d1043708c056085fb007c..0000000000000000000000000000000000000000 --- a/templates/stichprobe.ini.j2 +++ /dev/null @@ -1,24 +0,0 @@ -# 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 }}