From cea57cdd734c1eadfb861e6ff2fb95c1a92d016f Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Mon, 21 Mar 2016 13:21:35 +0000 Subject: [PATCH] Scripts and Templates to use default files directory --- .gitignore | 1 - tasks/elasticsearch-config.yml | 4 ++-- tasks/elasticsearch-scripts.yml | 7 +++++-- tasks/elasticsearch-templates.yml | 8 +++++++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 3a02b2e..0bb96d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .kitchen/ -.kitchen.local.yml *.lock .vendor .bundle diff --git a/tasks/elasticsearch-config.yml b/tasks/elasticsearch-config.yml index 28a421d..70a1f42 100644 --- a/tasks/elasticsearch-config.yml +++ b/tasks/elasticsearch-config.yml @@ -56,13 +56,13 @@ #Copy the instance specific init file - 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' + when: ansible_os_family == 'Debian' and not use_system_d 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' + when: ansible_os_family == 'RedHat' and not use_system_d notify: restart elasticsearch #Copy the systemd specific file if systemd is installed diff --git a/tasks/elasticsearch-scripts.yml b/tasks/elasticsearch-scripts.yml index 6d7d297..aa363e8 100644 --- a/tasks/elasticsearch-scripts.yml +++ b/tasks/elasticsearch-scripts.yml @@ -7,8 +7,11 @@ - name: Create script dir file: state=directory path={{ es_script_dir }} owner={{ es_user }} group={{ es_group }} - when: es_config['path.scripts'] is defined + +- name: Copy default scripts to elasticsearch + copy: src=scripts dest={{ es_script_dir }} owner={{ es_user }} group={{ es_group }} + when: es_scripts_fileglob is not defined - name: Copy scripts to elasticsearch copy: src={{ item }} dest={{ es_script_dir }} owner={{ es_user }} group={{ es_group }} - with_fileglob: es_scripts_fileglob | default("scripts") + with_fileglob: es_scripts_fileglob diff --git a/tasks/elasticsearch-templates.yml b/tasks/elasticsearch-templates.yml index ba46fd8..0fe3a0f 100644 --- a/tasks/elasticsearch-templates.yml +++ b/tasks/elasticsearch-templates.yml @@ -1,8 +1,14 @@ --- +- file: path=/etc/elasticsearch/templates state=directory owner={{ es_user }} group={{ es_group }} + +- name: Copy default templates to elasticsearch + copy: src=templates dest=/etc/elasticsearch/ owner={{ es_user }} group={{ es_group }} + when: es_templates_fileglob is not defined + - name: Copy templates to elasticsearch copy: src={{ item }} dest=/etc/elasticsearch/ owner={{ es_user }} group={{ es_group }} - with_fileglob: es_templates_fileglob | default("templates") + with_fileglob: es_templates_fileglob - set_fact: http_port=9200