From 0b139e457b918a0a5db91e3fc68824b2cc25c7e6 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 3 Oct 2024 12:51:18 +0200 Subject: [PATCH] Ensure that /usr/lib/systemd/system exists. --- tasks/tomcat-pkgs.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tasks/tomcat-pkgs.yml b/tasks/tomcat-pkgs.yml index fbc2864..444696e 100644 --- a/tasks/tomcat-pkgs.yml +++ b/tasks/tomcat-pkgs.yml @@ -121,10 +121,13 @@ - ansible_distribution_version is version_compare('24.04', '<') tags: ['tomcat', 'tomcat_serverxml', 'tomcat_conf', 'tomcat_init'] -- name: tomcat-pkgs | Reload the systemd daemon if we are running on a systemd-backed server - ansible.builtin.systemd: - daemon-reload: true - when: reload_systemd +- name: tomcat-pkgs | Ensure that /usr/lib/systemd/system exists + ansible.builtin.file: + path: /usr/lib/systemd/system + state: directory + owner: root + group: root + mode: "0755" tags: ['tomcat', 'tomcat_instances', 'tomcat_init'] - name: tomcat-pkgs | Install the systemd unit @@ -135,11 +138,18 @@ group: root mode: "0644" notify: tomcat restart + register: reload_systemd when: - tomcat_use_systemd_unit - ansible_distribution_version is version_compare('24.04', '<') tags: ['tomcat', 'tomcat_serverxml', 'tomcat_conf'] +- name: tomcat-pkgs | Reload the systemd daemon if we are running on a systemd-backed server + ansible.builtin.systemd: + daemon-reload: true + when: reload_systemd + tags: ['tomcat', 'tomcat_instances', 'tomcat_init'] + - name: tomcat-pkgs | Install a slightly modified catalina.properties ansible.builtin.template: src: catalina.properties.j2