Skip to content

Commit

Permalink
separate solr tasks so it can be deployed to its own server (#126)
Browse files Browse the repository at this point in the history
* separate solr tasks so it can be deployed to its own server

* update ansible_ssh_host -> ansible_host
  • Loading branch information
Natkeeran authored and dannylamb committed Aug 27, 2019
1 parent d747f6a commit e29de05
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 27 deletions.
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
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

0 comments on commit e29de05

Please sign in to comment.