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:
- name: Remove if it is a normal file path: "{{ sysd_script }}"
file: register: sysd_stat_result
path: "{{ sysd_script }}"
state: absent - name: Remove if it is a normal file
when: not sysd_stat_result.stat.islnk file:
path: "{{ sysd_script }}"
- name: Create a symbolic link to the default systemd location to the first instance running on this host state: absent
become: yes when: not sysd_stat_result.stat.islnk
file:
state: link - name: Create a symbolic link to the default systemd location to the first instance running on this host
src: "{{ instance_sysd_script }}" become: yes
path: "{{ sysd_script }}" file:
when: state: link
- use_system_d src: "{{ instance_sysd_script }}"
- not sysd_stat_result.stat.islnk path: "{{ sysd_script }}"
notify: when: 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