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

separate solr tasks so it can be deployed to its own server #126

Merged
merged 2 commits into from
Aug 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions inventory/vagrant/group_vars/solr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ solr_cores:
- CLAW

solr_install_path: /opt/solr

solr_user: solr
solr_instance_conf_path: /var/solr/data/CLAW/conf
2 changes: 1 addition & 1 deletion inventory/vagrant/hosts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by Vagrant

default ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222 ansible_ssh_private_key_file='.vagrant/machines/default/virtualbox/private_key'
default ansible_host=127.0.0.1 ansible_port=2222 ansible_ssh_private_key_file='.vagrant/machines/default/virtualbox/private_key'

[karaf]
default
Expand Down
3 changes: 0 additions & 3 deletions roles/internal/webserver-app/meta/main.yml

This file was deleted.

34 changes: 10 additions & 24 deletions roles/internal/webserver-app/tasks/solr.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,16 @@
---


# Only tasks related to configuring search_api_solr are put here
# Solr server configuration should go into the solr playbook: https://github.com/Islandora-Devops/claw-playbook/blob/dev/solr.yml

- name: Set default solr server host from hostvars
command: "{{ drush_path }} --root {{ drupal_core_path }} -y config-set search_api.server.default_solr_server backend_config.connector_config.host {{ hostvars[groups['solr'][0]].ansible_host }}"
register: set_search_api_config_host
changed_when: "'Do you want to update' in set_search_api_config.stdout"

- name: Set default solr server to point to CLAW core
command: "{{ drush_path }} --root {{ drupal_core_path }} -y config-set search_api.server.default_solr_server backend_config.connector_config.core CLAW"
register: set_search_api_config
register: set_search_api_config_core
changed_when: "'Do you want to update' in set_search_api_config.stdout"

- name: Get solr config files to copy
command: "find {{ webserver_document_root }}/drupal/web/modules/contrib/search_api_solr/solr-conf/7.x -type f"
register: files_to_copy
changed_when: false

- name: Copy solr config files
copy:
src: "{{ item }}"
dest: "{{ solr_instance_conf_path }}"
owner: "{{ solr_user }}"
group: "{{ solr_user }}"
remote_src: True
with_items:
- "{{ files_to_copy.stdout_lines }}"

# https://www.drupal.org/project/search_api_solr/issues/3015993
- name: Set solr_install_path in solrcore.properties
lineinfile:
path: /var/solr/data/CLAW/conf/solrcore.properties
regexp: '^solr\.install\.dir=.*$'
line: solr.install.dir={{ solr_install_path }}
state: present
notify: restart solr
31 changes: 31 additions & 0 deletions solr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,34 @@
java_packages:
- java-1.8.0-openjdk
- geerlingguy.solr

tasks:
- name: Unarchive solr config
unarchive:
src: "https://ftp.drupal.org/files/projects/search_api_solr-8.x-2.0.zip"
dest: /tmp
remote_src: yes

- name: Get solr config files to copy
command: "find /tmp/search_api_solr/solr-conf/7.x -type f"
register: files_to_copy
changed_when: false

- name: Copy solr config files
copy:
src: "{{ item }}"
dest: "{{ solr_instance_conf_path }}"
owner: "{{ solr_user }}"
group: "{{ solr_user }}"
remote_src: True
with_items:
- "{{ files_to_copy.stdout_lines }}"

# https://www.drupal.org/project/search_api_solr/issues/3015993
- name: Set solr_install_path in solrcore.properties
lineinfile:
path: "{{ solr_instance_conf_path }}/solrcore.properties"
regexp: '^solr\.install\.dir=.*$'
line: solr.install.dir={{ solr_install_path }}
state: present
notify: restart solr