From 6c4289b2df9c620b17fc2b0f525c00c67c8d0a2f Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Fri, 27 Nov 2015 21:43:49 +0000 Subject: [PATCH] Systemd temp path for Debian 8 --- README.md | 2 +- tasks/elasticsearch-config.yml | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 44f05f5..fdb20f3 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,6 @@ Following variables affect the versions installed: * The role assumes the user/group exists on the server. The elasticsearch packages create the default elasticsearch user. If this needs to be changed, ensure the user exists. * The playbook relies on the inventory_name of each host to ensure its directories are unique -* Systemd scripts are by default installed in addition to init scripts. This is pending improvement and currently relies on the user to determine the prefered mechanism. +* Systemd scripts are by default installed in addition to init scripts - with the exception of Debian 8. This is pending improvement and currently relies on the user to determine the preferred mechanism. * Changing an instance_name for a role application will result in the installation of a new component. The previous component will remain. * KitchenCI has been used for testing. This is used to confirm images reach the correct state after a play is first applied. diff --git a/tasks/elasticsearch-config.yml b/tasks/elasticsearch-config.yml index 5afed39..afbec76 100644 --- a/tasks/elasticsearch-config.yml +++ b/tasks/elasticsearch-config.yml @@ -6,8 +6,10 @@ - stat: path={{sysd_script}} register: systemd_service +- set_fact: use_system_d={{systemd_service.stat.exists and (ansible_os_family == 'RedHat' or ansible_distribution_version | version_compare('8', '<'))}} + - set_fact: instance_sysd_script={{sysd_script | dirname }}/{{es_instance_name}}_{{sysd_script | basename}} - when: systemd_service.stat.exists + when: use_system_d #For directories we also use the {{inventory_hostname}}-{{ es_instance_name }} - this helps if we have a shared SAN. @@ -58,7 +60,7 @@ #Copy the systemd specific file if systemd is installed - name: Copy Systemd File for Instance template: src=systemd/elasticsearch.j2 dest={{instance_sysd_script}} mode=0644 force=yes - when: systemd_service.stat.exists + when: use_system_d notify: restart elasticsearch #Copy the logging.yml