Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solr upgrade #25

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions yml/roles/alfresco/tasks/repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,19 @@
flat: yes
when: checked_privs.failed == false and s3_props.stdout_lines | length == 0

- name: Get search variables from JmxDump
connection: local
shell: unzip -p ../assets/{{ inventory_hostname }}/conf/jmxdump-{{ inventory_hostname }}.zip | awk '{{item}}'
args:
warn: false
register: jmx_params
with_items:
- /Alfresco:Type=Configuration,Category=Search,id1=manager/ { getline; getline; if ($0 ~ /^sourceBeanName/) print $2}
- /solr.secureComms/ { print $2 }
- /solr.sharedSecret/ { print $2 }

- name: Set search variables from JmxDump
set_fact:
solr_engine: "{{ jmx_params.results[0].stdout_lines[0] }}"
solr_secureComms_value: "{{ jmx_params.results[1].stdout_lines[0] }}"
solr_secret_value: "{{ jmx_params.results[2].stdout_lines[0] }}"
42 changes: 3 additions & 39 deletions yml/roles/solr/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,53 +11,17 @@
with_items:
- "{{ solr_client_cert | default('solrclient_crt') }}"
- "{{ solr_client_key | default('solrclient_key') }}"
when: solr_engine == 'solr6' or solr_engine == 'solr4'

- include: solr6.yml
loop: "{{ ps_search_service.stdout_lines }}"
loop_control:
loop_var: outer_loop
index_var: outer_loop_key
when: ps_search_service is defined and ps_search_service.rc == 0
when: solr_engine == 'solr6'

- include: solr4.yml
when: ps_search_service.failed | default(false)

- name: get Solr server info
uri:
url: "{{ solr_scheme }}://localhost:{{ solr_port }}/{{ solr_context }}/admin/info/system?wt=json"
return_content: yes
client_cert: "{{ hc_tmp }}/{{ solr_client_cert | default('solrclient_crt') }}"
client_key: "{{ hc_tmp }}/{{ solr_client_key | default('solrclient_key') }}"
validate_certs: no
status_code:
- 404
- 200
register: solr_info

- name: get Solr (1.4) server info
uri:
url: "{{ solr_scheme }}://localhost:{{ solr_port }}/{{ solr_context }}/alfresco/admin/system?wt=json"
return_content: yes
client_cert: "{{ hc_tmp }}/{{ solr_client_cert | default('solrclient_crt') }}"
client_key: "{{ hc_tmp }}/{{ solr_client_key | default('solrclient_key') }}"
validate_certs: no
register: "{{ solr_info if solr_info.status == 404 else summy_solr_info_register }}"
when: solr_info.status == 404

- name: Generate Solr SUMMARY report
get_url:
url: "{{ solr_scheme }}://localhost:{{ solr_port }}/{{ solr_context }}/admin/cores?action=SUMMARY&wt=xml"
dest: "{{ hc_tmp }}/solr-SUMMARY-{{ inventory_hostname }}.xml"
client_cert: "{{ hc_tmp }}/{{ solr_client_cert | default('solrclient_crt') }}"
client_key: "{{ hc_tmp }}/{{ solr_client_key | default('solrclient_key') }}"
timeout: "{{ solr_summary_report_timeout }}"
validate_certs: no

- name: Fetch Solr SUMMARY report
fetch:
src: "{{ hc_tmp }}/solr-SUMMARY-{{ inventory_hostname }}.xml"
dest: ../assets/{{ inventory_hostname }}/
flat: yes
when: solr_engine == 'solr4'

- include: index.yml
when: checked_privs.failed | default(false) == false or checked_solr6_privs.failed | default(false) == false
71 changes: 63 additions & 8 deletions yml/roles/solr/tasks/solr4.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: Find Solr log files
- name: Find Solr log files - Solr4
find:
paths: "{{ hostvars[inventory_hostname]['solr_log_pattern'] | default(solr_cwd + '/placeholder' ) | dirname }}"
patterns: "{{ hostvars[inventory_hostname]['solr_log_pattern'] | default('solr.log*') | basename }}"
Expand All @@ -8,7 +8,7 @@
become_user: "{{ solr_user }}"
register: found_solr_logs

- name: Archive Solr log files
- name: Archive Solr log files - Solr4
archive:
path: "{{ found_solr_logs.files | map(attribute='path') | list }}"
dest: "{{ hc_tmp }}/solr-log.zip"
Expand All @@ -18,14 +18,14 @@
become_user: "{{ solr_user }}"
when: found_solr_logs.matched > 0

- name: Fetch archived Solr log files
- name: Fetch archived Solr log files - Solr4
fetch:
src: "{{ hc_tmp }}/solr-log.zip"
dest: ../assets/{{ inventory_hostname }}/logs/
flat: yes
when: found_solr_logs.matched > 0

- name: Get Solr home
- name: Get Solr home - Solr4
xml:
path: "{{ solr_base }}/conf/Catalina/localhost/{{ solr_context | replace('/','#') }}.xml"
xpath: /Context/Environment[@name='solr/home']
Expand All @@ -36,7 +36,7 @@
become_user: "{{ solr_user }}"
when: hostvars[inventory_hostname]['solr_home'] is undefined

- name: Archive Solr config
- name: Archive Solr config - Solr4
archive:
dest: "{{ hc_tmp }}/solr-cores-cfg.zip"
path:
Expand All @@ -48,14 +48,25 @@
become_user: "{{ solr_user }}"
when: solr_home_attr.failed | default(false) == false or solr_home_attr.skipped | default(false) == true

- name: Fetch archived Solr config
- name: Fetch archived Solr config - Solr4
fetch:
src: "{{ hc_tmp }}/solr-cores-cfg.zip"
dest: ../assets/{{ inventory_hostname }}/conf/
flat: yes
when: solr_home_attr.failed | default(false) == false or solr_home_attr.skipped | default(false) == true

- name: Generate Solr SUMMARY report
- name: get Solr server info - Solr4
uri:
url: "{{ solr_scheme }}://localhost:{{ solr_port }}/{{ solr_context }}/alfresco/admin/system?wt=json"
return_content: yes
client_cert: "{{ hc_tmp }}/{{ solr_client_cert | default('solrclient_crt') }}"
client_key: "{{ hc_tmp }}/{{ solr_client_key | default('solrclient_key') }}"
validate_certs: no
register: "{{ solr_info if solr_info.status == 404 else summy_solr_info_register }}"
when: solr_info.status == 404 and solr_engine == 'solr4'


- name: Generate Solr SUMMARY report - Solr4
get_url:
url: "{{ solr_scheme }}://localhost:{{ solr_port }}/{{ solr_context }}/admin/cores?action=SUMMARY&wt=xml"
dest: "{{ hc_tmp }}/solr-SUMMARY-{{ inventory_hostname }}.xml"
Expand All @@ -64,9 +75,53 @@
timeout: "{{ solr_summary_report_timeout }}"
validate_certs: no

- name: Fetch Solr SUMMARY report
- name: Fetch Solr SUMMARY report - Solr4
fetch:
src: "{{ hc_tmp }}/solr-SUMMARY-{{ inventory_hostname }}.xml"
dest: ../assets/{{ inventory_hostname }}/
flat: yes

- name: Generate Solr Archived Content - Solr4
get_url:
url: "{{ solr_scheme }}://localhost:{{ solr_port }}/{{ solr_context }}/archive/afts?facet.range.end=NOW-2DAY&facet.range.gap=%2B1DAY&facet.range.start=NOW-2YEAR&facet.range=sys:archivedDate&facet=true&indent=on&q=*&rows=0&wt=json"
dest: "{{ hc_tmp }}/solr-Archived-{{ inventory_hostname }}.json"
client_cert: "{{ hc_tmp }}/{{ solr_client_cert | default('solrclient_crt') }}"
client_key: "{{ hc_tmp }}/{{ solr_client_key | default('solrclient_key') }}"
timeout: "{{ solr_summary_report_timeout }}"
validate_certs: no

- name: Fetch Solr Archived Content - Solr4
fetch:
src: "{{ hc_tmp }}/solr-Archived-{{ inventory_hostname }}.json"
dest: ../assets/{{ inventory_hostname }}/
flat: yes

- name: Generate Solr Alfresco Pivot report - Solr4
get_url:
url: "{{ solr_scheme }}://localhost:{{ solr_port }}/{{ solr_context }}/alfresco/select?facet.pivot={!stats=piv1}TYPE&facet=on&indent=on&q=*&rows=0&stats.field={!tag=piv1%20sum=on%20count=on}cm:content.size&stats=on&wt=json"
dest: "{{ hc_tmp }}/solr-Alfresco-Pivot-{{ inventory_hostname }}.json"
client_cert: "{{ hc_tmp }}/{{ solr_client_cert | default('solrclient_crt') }}"
client_key: "{{ hc_tmp }}/{{ solr_client_key | default('solrclient_key') }}"
timeout: "{{ solr_summary_report_timeout }}"
validate_certs: no

- name: Fetch Solr Archived Content - Solr4
fetch:
src: "{{ hc_tmp }}/solr-Alfresco-Pivot-{{ inventory_hostname }}.json"
dest: ../assets/{{ inventory_hostname }}/
flat: yes

- name: Generate Solr Archived Content - Solr4
get_url:
url: "{{ solr_scheme }}://localhost:{{ solr_port }}/{{ solr_context }}/archive/select?facet.pivot={!stats=piv1}TYPE&facet=on&indent=on&q=*&rows=0&stats.field={!tag=piv1%20sum=on%20count=on}cm:content.size&stats=on&wt=json"
dest: "{{ hc_tmp }}/solr-Archive-Pivot-{{ inventory_hostname }}.json"
client_cert: "{{ hc_tmp }}/{{ solr_client_cert | default('solrclient_crt') }}"
client_key: "{{ hc_tmp }}/{{ solr_client_key | default('solrclient_key') }}"
timeout: "{{ solr_summary_report_timeout }}"
validate_certs: no

- name: Fetch Solr Archived Content - Solr4
fetch:
src: "{{ hc_tmp }}/solr-Archive-Pivot-{{ inventory_hostname }}.json"
dest: ../assets/{{ inventory_hostname }}/
flat: yes
Loading