From 6892a2efdf4c501210d982b550f338ee43dde095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Sachse?= <joerg.sachse@slub-dresden.de> Date: Thu, 15 Aug 2024 14:57:24 +0200 Subject: [PATCH] refactor: move tasks for configuring ZIH maintenance window into separate tasks file and assign useful tags --- tasks/configure_maintenance.yml | 44 ++++++++++++++++++++++++++++++++ tasks/install_subapp.yml | 45 --------------------------------- tasks/main.yml | 4 +++ 3 files changed, 48 insertions(+), 45 deletions(-) create mode 100644 tasks/configure_maintenance.yml diff --git a/tasks/configure_maintenance.yml b/tasks/configure_maintenance.yml new file mode 100644 index 0000000..90a0036 --- /dev/null +++ b/tasks/configure_maintenance.yml @@ -0,0 +1,44 @@ +--- +# ZIH has monthly maintenance windows for their VMware environment, which also +# affects the Library Manager VMs used by SLUBArchiv.digital. This time window +# is also used for upgrading the OS and IBM packages on the storage servers. To +# make sure that there is no write/read access during that time, we shutdown +# the DisApp and SubApp and start them afterwards using systemd timers. +- name: create directory for SystemD units + ansible.builtin.file: + path: "/usr/local/lib/systemd/system/" + mode: "0755" + state: directory + owner: "root" + group: "root" + +- name: install SubApp/DisApp maintenance services and timers + ansible.builtin.template: + src: "usr/local/lib/systemd/system/{{ item }}.j2" + dest: "/usr/local/lib/systemd/system/{{ item }}" + mode: "0644" + owner: "root" + group: "root" + loop: + - "disapp_maintenance_begin.service" + - "disapp_maintenance_begin.timer" + - "disapp_maintenance_end.timer" + - "subapp_maintenance_begin.service" + - "subapp_maintenance_begin.timer" + - "subapp_maintenance_end.timer" + +- name: enable SubApp/DisApp maintenance services and timers + ansible.builtin.systemd: + name: "{{ item.name }}" + enabled: "{{ item.enabled | default(true) }}" + state: "{{ item.state | default('started') }}" + daemon_reload: true + loop: + - name: "disapp_maintenance_begin.service" + state: "stopped" + - name: "disapp_maintenance_begin.timer" + - name: "disapp_maintenance_end.timer" + - name: "subapp_maintenance_begin.service" + state: "stopped" + - name: "subapp_maintenance_begin.timer" + - name: "subapp_maintenance_end.timer" diff --git a/tasks/install_subapp.yml b/tasks/install_subapp.yml index 8b89279..1939f00 100644 --- a/tasks/install_subapp.yml +++ b/tasks/install_subapp.yml @@ -213,48 +213,3 @@ dest: "/home/{{ vault_subapp_user }}/.subapp/subapp_ws_logs" owner: "{{ vault_subapp_user }}" group: "{{ vault_subapp_group }}" - -# ZIH has monthly maintenance windows for their VMware environment, which also -# affects the Library Manager VMs used by SLUBArchiv.digital. This time window -# is also used for upgrading the OS and IBM packages on the storage servers. To -# make sure that there is no write/read access during that time, we shutdown -# the DisApp and SubApp and start them afterwards using systemd timers. -- name: create directory for SystemD units - ansible.builtin.file: - path: "/usr/local/lib/systemd/system/" - mode: "0755" - state: directory - owner: "root" - group: "root" - tags: [ maintenance_window ] -- name: install SubApp/DisApp maintenance services and timers - ansible.builtin.template: - src: "usr/local/lib/systemd/system/{{ item }}.j2" - dest: "/usr/local/lib/systemd/system/{{ item }}" - mode: "0644" - owner: "root" - group: "root" - loop: - - "disapp_maintenance_begin.service" - - "disapp_maintenance_begin.timer" - - "disapp_maintenance_end.timer" - - "subapp_maintenance_begin.service" - - "subapp_maintenance_begin.timer" - - "subapp_maintenance_end.timer" - tags: [ maintenance_window ] -- name: enable SubApp/DisApp maintenance services and timers - ansible.builtin.systemd: - name: "{{ item.name }}" - enabled: "{{ item.enabled | default(true) }}" - state: "{{ item.state | default('started') }}" - daemon_reload: true - loop: - - name: "disapp_maintenance_begin.service" - state: "stopped" - - name: "disapp_maintenance_begin.timer" - - name: "disapp_maintenance_end.timer" - - name: "subapp_maintenance_begin.service" - state: "stopped" - - name: "subapp_maintenance_begin.timer" - - name: "subapp_maintenance_end.timer" - tags: [ maintenance_window ] diff --git a/tasks/main.yml b/tasks/main.yml index 4ecbe07..545f833 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -48,6 +48,10 @@ ansible.builtin.import_tasks: "install_subapp.yml" tags: [subapp] +- name: configure SubApp/DisApp maintenance timer + ansible.builtin.import_tasks: "configure_maintenance.yml" + tags: [subapp, maintenance, systemd, timer, cron, cronjob] + - name: Userbezogene Konfiguration für User processing einspielen ansible.builtin.import_tasks: "configure_processing_user.yml" tags: [users, bash] -- GitLab