Copy a config set from an arbitrary location into Solr's core config directory, and apply the correct ownership + permissions.
This is meant to be used in conjunction with (and after) GeerlingGuy's solr role.
Warning: All of the contents of /{{ solr_home }}/data/{{ solr_core_name }}/conf
will be replaced by the contents of {{ solr_core_conf_source }}
. If you want your conf dir backed up, you'll need to do that before running this role.
- Your solr core must already exist.
- If you're using GeerlingGuy's solr role, then list your core name as one of the items in the
solr_cores
variable. Or create your core manually in the Solr UI. Or run the solr cli to create your core. Once your core is created, the directory specified bysolr_core_conf_dest
will exist, and this role can do its job.
- If you're using GeerlingGuy's solr role, then list your core name as one of the items in the
- If Solr is on the same server as Drupal, the core conf files can be copied from it. Use
solr_core_conf_source
for this.- Drupal 7 config can be obtained from the search api module.
- Drupal 8 solr config must be generated by Drupal (which seems awkward, because it is).
- Either way, commit your solr config files and deploy them to your server before you use this role.
- If Solr is on a different server from Drupal, the core conf files can be copied from the Ansible controller (eg, your locahost). Use
solr_core_conf_local_source
for this.
- solr_core_name: Name of the solr core that the conf files will be attached to
- One of solr_core_conf_local_source OR solr_core_conf_source:
solr_core_conf_local_source
: Absolute path to the directory on the ansible controller that contains your config set. If this variable is set, any previous value forsolr_core_conf_source
is ignored.solr_core_conf_source
: Absolute path to the directory on the server that contains your solr schema files. This can be used when you've committed your schema files to your drupal repository, and then your CI deploy job has already placed them on the server, ready for processing by this role.
- solr_service_name: In case your solr service is named something other than
solr
. - solr_home: In case your solr files were configured somewhere other than
/var/solr
- solr_core_conf_dest: Defaults to
"{{ solr_home }}/data/{{ solr_core_name }}/conf"
. You shouldn't ever need to change this. It's only noted here, because it's very easy to miss creating your core before using t his role. This role does not create the solr core for you. See the Requirements section above.
- hosts: web_servers
become: true
gather_facts: true
roles:
- name: Install Solr 8 for use by my Drupal 9 site
role: geerlingguy.solr
solr_cores:
- siteXYZcore
- name: Configure my drupal 9 site
role: acromedia.virtual-host
# ... etc etc etc...
- name: Configure the solr core for my D9 site, whose config I generated from my local lando dev environment, and then deployed to my server.
role: acromedia.solr-core-config
vars:
solr_core_conf_source: /var/www/vhosts/siteXYZ/src/solr_conf
solr_core_name: siteXYZcore
# When using the same role more than once in the same playbook, it's safest to separate them into thier own plays.
- hosts: web_servers
become: true
gather_facts: true
roles:
- name: Install solr 6 alongside the default solr 6 install, to support my Drupal 7 site
role: geerlingguy.solr
solr_version: "6.6.6"
solr_service_name: solr6
solr_port: "8986"
solr_home: "/var/{{ solr_service_name }}"
solr_cores:
- mySolr6core
- name: Configure my drupal 7 site
role: acromedia.virtual-host
# ... etc etc etc...
- name: Configure solr core for my D7 site, whose config comes from the search_api_solr module.
role: acromedia.solr-core-config
vars:
solr_core_conf_source: /var/www/vhosts/siteABC/public_html/modules/contrib/search_api_solr/solr-conf/6.x
solr_core_name: mySolr6core
solr_service_name: solr6
solr_home: /var/solr6
- hosts: servers
roles:
- name: Use locally committed solr schema (which we generated from Drupal 8), to configure a solr core
role: acromedia.solr-core-config
vars:
solr_core_conf_local_source: "{{ playbook_dir }}/solr/config"
solr_core_name: coreBFG
GPLv3
Acro Media Inc.