Fix systemd unit file installation in case the file does not exist
This commit is contained in:
parent
50a8f3b144
commit
c70fa8f848
1 changed files with 3 additions and 4 deletions
|
|
@ -93,20 +93,19 @@
|
|||
stat:
|
||||
path: "{{ sysd_script }}"
|
||||
register: sysd_stat_result
|
||||
|
||||
|
||||
- name: Remove if it is a normal file
|
||||
file:
|
||||
path: "{{ sysd_script }}"
|
||||
state: absent
|
||||
when: not sysd_stat_result.stat.islnk
|
||||
|
||||
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
|
||||
file:
|
||||
state: link
|
||||
src: "{{ instance_sysd_script }}"
|
||||
path: "{{ sysd_script }}"
|
||||
when: not sysd_stat_result.stat.islnk
|
||||
notify:
|
||||
- reload systemd configuration
|
||||
- restart elasticsearch
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue