More compact fix of systemd unit file setup
This commit is contained in:
parent
c70fa8f848
commit
a41d3a58c6
1 changed files with 10 additions and 21 deletions
|
|
@ -86,24 +86,13 @@
|
||||||
content: ''
|
content: ''
|
||||||
when: ansible_os_family == 'RedHat'
|
when: ansible_os_family == 'RedHat'
|
||||||
|
|
||||||
|
# We need the force parameter to be able to overwrite the default non-link file
|
||||||
- name: Symlink default systemd service to first instance of elasticsearch
|
- name: Symlink default systemd service to first instance of elasticsearch
|
||||||
when: use_system_d
|
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
|
|
||||||
file:
|
|
||||||
path: "{{ sysd_script }}"
|
|
||||||
state: absent
|
|
||||||
when: sysd_stat_result.stat.exists and not sysd_stat_result.stat.islnk
|
|
||||||
|
|
||||||
- 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
|
||||||
|
force: yes
|
||||||
src: "{{ instance_sysd_script }}"
|
src: "{{ instance_sysd_script }}"
|
||||||
path: "{{ sysd_script }}"
|
path: "{{ sysd_script }}"
|
||||||
notify:
|
notify:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue