Fixes for serverspec
This commit is contained in:
parent
37447d1618
commit
145f345ec1
5 changed files with 24 additions and 20 deletions
|
|
@ -1,6 +1,14 @@
|
|||
---
|
||||
|
||||
# Configure Elasticsearch Node
|
||||
|
||||
#This relies on elasticsearch installing a serviced script to determine whether one should be copied.
|
||||
- stat: path={{sysd_script}}
|
||||
register: systemd_service
|
||||
|
||||
- set_fact: instance_sysd_script={{sysd_script | dirname }}/{{es_instance_name}}_{{sysd_script | basename}}
|
||||
when: systemd_service.stat.exists
|
||||
|
||||
#For directories we also use the {{inventory_hostname}}-{{ es_instance_name }} - this helps if we have a shared SAN.
|
||||
|
||||
- set_fact: pid_dir={{es_pid_dir}}/{{inventory_hostname}}-{{ es_instance_name }}
|
||||
|
|
@ -45,12 +53,12 @@
|
|||
#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'
|
||||
|
||||
#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
|
||||
when: systemd_service.stat.exists
|
||||
notify: restart elasticsearch
|
||||
|
||||
#Copy the logging.yml
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
- set_fact: instance_default_file={{default_file | dirname}}/{{es_instance_name}}_{{default_file | basename}}
|
||||
- set_fact: instance_init_script={{init_script | dirname }}/{{es_instance_name}}_{{init_script | basename}}
|
||||
- set_fact: instance_config_directory={{ es_conf_dir }}/{{es_instance_name}}
|
||||
- stat: path={{sysd_script}}
|
||||
register: systemd_service
|
||||
- set_fact: instance_sysd_script={{sysd_script | dirname }}/{{es_instance_name}}_{{sysd_script | basename}}
|
||||
when: systemd_service
|
||||
- set_fact: m_lock_enabled={{ es_config['bootstrap.mlockall'] is defined and es_config['bootstrap.mlockall'] == True }}
|
||||
|
||||
- debug: msg="Node configuration {{ es_config }} "
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ ES_HOME={{es_home}}
|
|||
CONF_DIR={{instance_config_directory}}
|
||||
|
||||
# Elasticsearch configuration file
|
||||
CONF_FILE=$CONF_DIR/elasticsearch.yml
|
||||
CONF_FILE={{instance_config_directory}}/elasticsearch.yml
|
||||
|
||||
# Elasticsearch data directory
|
||||
DATA_DIR={{data_dir}}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
[Unit]
|
||||
Description=Elasticsearch
|
||||
Description=Elasticsearch-{{es_instance_name}}
|
||||
Documentation=http://www.elastic.co
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
|
|
|||
|
|
@ -87,18 +87,6 @@ context "basic tests" do
|
|||
end
|
||||
end
|
||||
|
||||
#test to make sure mlock was applied
|
||||
describe command('curl "localhost:9200/_nodes/localhost-master/process?pretty" | grep mlockall') do
|
||||
its(:stdout) { should match /\"mlockall\" : true/ }
|
||||
its(:exit_status) { should eq 0 }
|
||||
end
|
||||
|
||||
#test to make sure mlock was not applied
|
||||
describe command('curl "localhost:9201/_nodes/localhost-node1/process?pretty" | grep mlockall') do
|
||||
its(:stdout) { should match /\"mlockall\" : false/ }
|
||||
its(:exit_status) { should eq 0 }
|
||||
end
|
||||
|
||||
describe file('/etc/elasticsearch/templates') do
|
||||
it { should be_directory }
|
||||
it { should be_owned_by 'elasticsearch' }
|
||||
|
|
@ -160,5 +148,17 @@ context "basic tests" do
|
|||
it { should be_directory }
|
||||
it { should be_owned_by 'elasticsearch' }
|
||||
end
|
||||
|
||||
#test to make sure mlock was applied
|
||||
describe command('curl "localhost:9200/_nodes/localhost-master/process?pretty" | grep mlockall') do
|
||||
its(:stdout) { should match /true/ }
|
||||
its(:exit_status) { should eq 0 }
|
||||
end
|
||||
|
||||
#test to make sure mlock was not applied
|
||||
describe command('curl "localhost:9201/_nodes/localhost-node1/process?pretty" | grep mlockall') do
|
||||
its(:stdout) { should match /false/ }
|
||||
its(:exit_status) { should eq 0 }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue