From dc91b7008100e6d2b90fcafe0f34dd3a61b2b2e8 Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Mon, 21 Dec 2015 13:27:45 +0000 Subject: [PATCH] Systemd changes --- .gitignore | 3 ++- tasks/elasticsearch-config.yml | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index cf4e5c2..3a02b2e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ .bundle Converging TODO -.idea/ \ No newline at end of file +.idea/ +elasticsearch.iml \ No newline at end of file diff --git a/tasks/elasticsearch-config.yml b/tasks/elasticsearch-config.yml index 94f10c0..8bc50e3 100644 --- a/tasks/elasticsearch-config.yml +++ b/tasks/elasticsearch-config.yml @@ -2,10 +2,18 @@ # Configure Elasticsearch Node -#This relies on elasticsearch installing a serviced script to determine whether one should be copied. +#Use systemd for the following distributions: +# +#Ubuntu 15 and up +#Debian 8 and up +#Centos 7 and up +#Relies on elasticsearch distribution installing a serviced script to determine whether one should be copied. + + - stat: path={{sysd_script}} register: systemd_service -- set_fact: use_system_d={{systemd_service.stat.exists and (not ansible_distribution == 'Debian' or ansible_distribution_version | version_compare('8', '<'))}} + +- set_fact: use_system_d={{systemd_service.stat.exists and ((ansible_distribution == 'Debian' and ansible_distribution_version | version_compare('8', '>=')) or (ansible_distribution == 'CentOS' and ansible_distribution_version | version_compare('7', '>=')) or (ansible_distribution == 'Ubuntu' and ansible_distribution_version | version_compare('15', '>='))) }} - set_fact: instance_sysd_script={{sysd_script | dirname }}/{{es_instance_name}}_{{sysd_script | basename}} when: use_system_d @@ -53,11 +61,13 @@ - name: Copy Debian Init File for Instance template: src=init/debian/elasticsearch.j2 dest={{instance_init_script}} mode=0755 force=yes when: ansible_os_family == 'Debian' + notify: restart elasticsearch #Copy the instance specific init file - name: Copy Redhat Init File for Instance template: src=init/redhat/elasticsearch.j2 dest={{instance_init_script}} mode=0755 force=yes when: ansible_os_family == 'RedHat' + notify: restart elasticsearch #Copy the systemd specific file if systemd is installed - name: Copy Systemd File for Instance