diff --git a/inventory/vagrant/group_vars/solr.yml b/inventory/vagrant/group_vars/solr.yml index 3b72f1a4..958db565 100644 --- a/inventory/vagrant/group_vars/solr.yml +++ b/inventory/vagrant/group_vars/solr.yml @@ -4,3 +4,6 @@ solr_cores: - CLAW solr_install_path: /opt/solr + +solr_user: solr +solr_instance_conf_path: /var/solr/data/CLAW/conf diff --git a/roles/internal/webserver-app/meta/main.yml b/roles/internal/webserver-app/meta/main.yml deleted file mode 100644 index 792e9932..00000000 --- a/roles/internal/webserver-app/meta/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -dependencies: - - geerlingguy.solr diff --git a/roles/internal/webserver-app/tasks/solr.yml b/roles/internal/webserver-app/tasks/solr.yml index cae8a223..745e5224 100644 --- a/roles/internal/webserver-app/tasks/solr.yml +++ b/roles/internal/webserver-app/tasks/solr.yml @@ -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 diff --git a/solr.yml b/solr.yml index 3583169d..171b51a5 100644 --- a/solr.yml +++ b/solr.yml @@ -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 \ No newline at end of file