From 0b6863c2c025319efa85195e65fb91748ef05df5 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Tue, 31 Oct 2023 11:26:58 -0600 Subject: [PATCH] ostree systems cannot write to /usr; use /etc instead Use /etc/systemd/system instead of /usr/lib/systemd/system for the elasticsearch service file on ostree systems. Signed-off-by: Rich Megginson --- roles/elasticsearch/tasks/main.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/roles/elasticsearch/tasks/main.yml b/roles/elasticsearch/tasks/main.yml index 2e08e83..71d6377 100644 --- a/roles/elasticsearch/tasks/main.yml +++ b/roles/elasticsearch/tasks/main.yml @@ -51,6 +51,20 @@ - elasticsearch_metrics_provider == 'pcp' - elasticsearch_agent | d(false) | bool +- name: Check if system is ostree + stat: + path: "{{ ostree_booted_file }}" + vars: + ostree_booted_file: /run/ostree-booted + register: __ostree_booted_stat + +- name: Ensure correct service path for ostree systems + when: + - __ostree_booted_stat.stat.exists + - __elasticsearch_service_path != "/etc/systemd/system" + set_fact: + __elasticsearch_service_path: /etc/systemd/system + - name: Ensure PCP Elasticsearch export service exists template: src: pcp2elasticsearch.service.j2