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

fix: unify and corect all systemd paths and fix timer installation

parent 58a1c04d
No related branches found
No related tags found
No related merge requests found
[Unit] [Unit]
Description=timer for move_old_logs.service Description=timer for move_old_logs.service
[Timer] [Timer]
# run once a year, on the 1st of January at 05:00:00am. # run once a year, on the 1st of January at 05:00:00am.
OnCalendar=*-1-1 05:00:00 OnCalendar=*-1-1 05:00:00
Unit=move_old_logs.service Unit=move_old_logs.service
[Install]
WantedBy=default.target
...@@ -7,31 +7,25 @@ ...@@ -7,31 +7,25 @@
owner: "{{ item.owner | default('root') }}" owner: "{{ item.owner | default('root') }}"
group: "{{ item.group | default('root') }}" group: "{{ item.group | default('root') }}"
loop: loop:
- path: "etc/systemd/system/move_old_logs.timer" - path: "etc/systemd/user/move_old_logs.timer"
mode: "0644" mode: "0644"
- path: "usr/local/bin/move_old_logs.sh" - path: "usr/local/bin/move_old_logs.sh"
mode: "0755" mode: "0755"
notify: daemon-reload
- name: install service for moving old logs to archive - name: install service for moving old logs to archive
ansible.builtin.template: ansible.builtin.template:
src: "etc/systemd/system/move_old_logs.service.j2" src: "etc/systemd/user/move_old_logs.service.j2"
dest: "/etc/systemd/system/move_old_logs.service" dest: "/etc/systemd/user/move_old_logs.service"
mode: 0755 mode: 0755
owner: "root" owner: "root"
group: "root" group: "root"
notify: daemon-reload
- name: remove service/timer units from /etc/systemd/user/, they don't belong there - name: manually enable move_old_logs.service, because it cannot be found by the ansible.builtin.systemd module when the timer is located below "/etc/systemd/user/"
ansible.builtin.file: ansible.builtin.command: "systemctl enable /etc/systemd/user/move_old_logs.service"
path: "/etc/systemd/user/move_old_logs.{{ item }}"
state: absent
loop:
- "timer"
- "service"
- name: enable timer for moving old logs to archive - name: enable timer for moving old logs to archive
ansible.builtin.systemd: ansible.builtin.systemd:
name: "move_old_logs.timer" name: "move_old_logs.timer"
state: started state: started
enabled: true enabled: true
daemon_reload: true
...@@ -47,8 +47,8 @@ ...@@ -47,8 +47,8 @@
- name: Systemd-Unitfiles installieren (Files) - name: Systemd-Unitfiles installieren (Files)
copy: copy:
src: "etc/systemd/system/{{ item }}" src: "etc/systemd/user/{{ item }}"
dest: "/etc/systemd/system/{{ item }}" dest: "/etc/systemd/user/{{ item }}"
loop: loop:
- "chmod_sip_uploads.service" - "chmod_sip_uploads.service"
- "chown_dip_access.service" - "chown_dip_access.service"
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
tags: [systemd] tags: [systemd]
- name: Services automatisch bei jedem Booten starten - name: Services automatisch bei jedem Booten starten
command: "systemctl enable /etc/systemd/system/{{ item }}" # noqa 301 303 command: "systemctl enable /etc/systemd/user/{{ item }}" # noqa 301 303
loop: loop:
- "webservice_status_SLUBarchiv.service" - "webservice_status_SLUBarchiv.service"
- "subapp.service" - "subapp.service"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment