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,29 +86,30 @@
content: '' content: ''
when: ansible_os_family == 'RedHat' when: ansible_os_family == 'RedHat'
- name: Check if default systemd file exists - name: Symlink default systemd service to first instance of elasticsearch
stat: when: use_system_d
path: "{{ sysd_script }}" block:
register: sysd_stat_result - 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: file:
path: "{{ sysd_script }}" path: "{{ sysd_script }}"
state: absent state: absent
when: not sysd_stat_result.stat.islnk 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 become: yes
file: file:
state: link state: link
src: "{{ instance_sysd_script }}" src: "{{ instance_sysd_script }}"
path: "{{ sysd_script }}" path: "{{ sysd_script }}"
when: when: not sysd_stat_result.stat.islnk
- use_system_d notify:
- not sysd_stat_result.stat.islnk - reload systemd configuration
notify: - restart elasticsearch
- reload systemd configuration
- restart elasticsearch
- name: Delete Default Configuration File - name: Delete Default Configuration File
become: yes become: yes

View file

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

View file

@ -212,10 +212,6 @@ shared_examples 'multi::init' do |vars|
end end
end end
describe file('/usr/lib/systemd/system/elasticsearch.service') do
it { should_not exist }
end
describe file('/etc/elasticsearch/elasticsearch.yml') do describe file('/etc/elasticsearch/elasticsearch.yml') do
it { should_not exist } it { should_not exist }
end end
@ -223,18 +219,5 @@ shared_examples 'multi::init' do |vars|
describe file('/etc/elasticsearch/logging.yml') do describe file('/etc/elasticsearch/logging.yml') do
it { should_not exist } it { should_not exist }
end 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 end

View file

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

View file

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

View file

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