forked from geerlingguy/ansible-role-solr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-pre5.yml
78 lines (67 loc) · 2.16 KB
/
install-pre5.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
# Install Solr.
- name: Check if Solr is already installed.
stat: "path={{ solr_install_path }}/dist/{{ solr_filename }}.war"
register: solr_war_file
- name: Copy Solr into place.
command: "cp -r {{ solr_workspace }}/{{ solr_filename }} {{ solr_install_path }}"
when: not solr_war_file.stat.exists
- name: Ensure Solr install files are owned by the solr_user.
file:
path: "{{ solr_install_path }}"
owner: "{{ solr_user }}"
group: "{{ solr_user }}"
recurse: yes
when: not solr_war_file.stat.exists
# Set up solr_home.
- name: Check if solr_home is already set up.
stat: "path={{ solr_home }}/solr.xml"
register: solr_example
- name: Ensure solr_home directory exists.
file:
path: "{{ solr_home }}"
state: directory
owner: "{{ solr_user }}"
group: "{{ solr_user }}"
mode: 0755
when: not solr_example.stat.exists
- name: Copy Solr example into solr_home.
shell: "cp -r {{ solr_install_path }}/example/solr/* {{ solr_home }}"
when: not solr_example.stat.exists
- name: Fix the example solrconfig.xml file.
replace:
dest: "{{ solr_home }}/collection1/conf/solrconfig.xml"
regexp: ^.+solr\.install\.dir.+$
replace: ""
when: "not solr_example.stat.exists and solr_version.split('.')[0] == '4'"
- name: Ensure Solr home files are owned by the solr_user.
file:
path: "{{ solr_home }}"
owner: "{{ solr_user }}"
group: "{{ solr_user }}"
recurse: yes
when: not solr_example.stat.exists
# Set up Solr init script.
- name: Ensure log file is created and has proper permissions.
file:
path: "/var/log/solr.log"
state: touch
owner: "{{ solr_user }}"
group: root
mode: 0664
changed_when: false
- name: Copy solr init script into place.
template:
src: "solr-init-{{ ansible_os_family }}-pre5.j2"
dest: "/etc/init.d/{{ solr_service_name }}"
mode: 0755
- name: Run systemd daemon_reload (RHEL 7 workaround).
systemd:
name: solr
daemon_reload: yes
when: >
(ansible_os_family == 'RedHat')
and (ansible_distribution_version.split(".")[0] == '7')
- name: Ensure daemon is installed (Debian).
apt: name=daemon state=installed
when: ansible_os_family == "Debian"