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

chore: remove code that is no longer necessary when using SystemD template units

parent d7b53f1f
Branches
No related tags found
1 merge request!2merge feat_ND-2363_ND-2323 into master
--- ---
- name: remove legacy timer/service/script
ansible.builtin.file:
path: "{{ item }}"
state: absent
loop:
- "/etc/systemd/user/move_old_logs.timer"
- "/etc/systemd/user/move_old_logs.service"
- "/usr/local/bin/move_old_logs.sh"
####################################################################################################################
- name: create SystemD unit directory - name: create SystemD unit directory
ansible.builtin.file: ansible.builtin.file:
path: "/usr/local/lib/systemd/system/" path: "/usr/local/lib/systemd/system/"
...@@ -54,27 +43,3 @@ ...@@ -54,27 +43,3 @@
name: "move_old_logs.timer" name: "move_old_logs.timer"
enabled: true enabled: true
state: started state: started
# - name: find move_old_logs systemd units so we don't have to hardcode their names in the loops
# ansible.builtin.find:
# path: "/usr/local/lib/systemd/system/"
# pattern: "move_old_logs.*"
# register: move_old_logs_units
#
# - name: check if move_old_logs units are already enabled
# ansible.builtin.command: "systemctl is-enabled {{ item.path | basename }}"
# loop: "{{ move_old_logs_units.files }}"
# register: move_old_logs_enabled
# changed_when: false
# failed_when:
# - move_old_logs_enabled.stdout != "enabled"
# - move_old_logs_enabled.stdout != "disabled"
# - '"No such file or directory" not in move_old_logs_enabled.stderr'
#
# - 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.command: "systemctl enable {{ item.item.path }}"
# loop: "{{ move_old_logs_enabled.results }}"
# when:
# - item.stdout != "enabled"
# register: move_old_logs_enablecmd
# changed_when: move_old_logs_enablecmd.stdout in "Created symlink"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment