Only symlink systemd file for systemd systems

This commit is contained in:
Michael Russell 2018-06-18 07:37:51 +02:00
parent 23e336833a
commit d451d27723
No known key found for this signature in database
GPG key ID: A90C1696496085FE
6 changed files with 24 additions and 56 deletions

View file

@ -86,26 +86,27 @@
content: ''
when: ansible_os_family == 'RedHat'
- name: Check if default systemd file exists
- name: Symlink default systemd service to first instance of elasticsearch
when: use_system_d
block:
- name: Check if default systemd file exists
stat:
path: "{{ sysd_script }}"
register: sysd_stat_result
- name: Remove if it is a normal file
- name: Remove if it is a normal file
file:
path: "{{ sysd_script }}"
state: absent
when: not sysd_stat_result.stat.islnk
- name: Create a symbolic link to the default systemd location to the first instance running on this host
- name: Create a symbolic link to the default systemd location to the first instance running on this host
become: yes
file:
state: link
src: "{{ instance_sysd_script }}"
path: "{{ sysd_script }}"
when:
- use_system_d
- not sysd_stat_result.stat.islnk
when: not sysd_stat_result.stat.islnk
notify:
- reload systemd configuration
- restart elasticsearch

View file

@ -125,10 +125,6 @@ shared_examples 'config::init' do |vars|
end
end
describe file('/usr/lib/systemd/system/elasticsearch.service') do
it { should_not exist }
end
describe file('/etc/elasticsearch/elasticsearch.yml') do
it { should_not exist }
end

View file

@ -212,10 +212,6 @@ shared_examples 'multi::init' do |vars|
end
end
describe file('/usr/lib/systemd/system/elasticsearch.service') do
it { should_not exist }
end
describe file('/etc/elasticsearch/elasticsearch.yml') do
it { should_not exist }
end
@ -223,18 +219,5 @@ shared_examples 'multi::init' do |vars|
describe file('/etc/elasticsearch/logging.yml') do
it { should_not exist }
end
#Test server spec file has been created and modified - currently not possible as not copied for debian 8
#describe file('/usr/lib/systemd/system/master_elasticsearch.service') do
# it { should be_file }
# it { should contain 'LimitMEMLOCK=infinity' }
#end
#describe file('/usr/lib/systemd/system/node1_elasticsearch.service') do
# it { should be_file }
# it { should_not contain 'LimitMEMLOCK=infinity' }
#end
end

View file

@ -100,10 +100,6 @@ shared_examples 'package::init' do |vars|
end
end
describe file('/usr/lib/systemd/system/elasticsearch.service') do
it { should_not exist }
end
describe file('/etc/elasticsearch/elasticsearch.yml') do
it { should_not exist }
end

View file

@ -68,10 +68,6 @@ shared_examples 'xpack::init' do |vars|
end
end
describe file('/usr/lib/systemd/system/elasticsearch.service') do
it { should_not exist }
end
describe file('/etc/elasticsearch/elasticsearch.yml') do
it { should_not exist }
end

View file

@ -69,10 +69,6 @@ shared_examples 'xpack_standard::init' do |vars|
end
end
describe file('/usr/lib/systemd/system/elasticsearch.service') do
it { should_not exist }
end
describe file('/etc/elasticsearch/elasticsearch.yml') do
it { should_not exist }
end