Skip to content

Commit

Permalink
Only create Solr core when needed
Browse files Browse the repository at this point in the history
If we need to re-run the configure_new_box role, we don't want
it to fail because the required solr core has already been created.

This commit checks existing cores and skips creating a new core if
it sees an existing core with the expected project name.
  • Loading branch information
mark-dce committed Mar 14, 2024
1 parent fed7985 commit 38db8c7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions roles/configure_new_box/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,20 @@
- configure
# block end - configure Fedora

- name: check for existing solr core
ansible.builtin.uri:
url: http://localhost:8983/solr/admin/cores?action=STATUS&indexInfo=false&core={{ project_name }}
body_format: json
register: t3_core

- name: create default solr collection
become: yes
become_user: solr
shell: /opt/solr/bin/solr create -c {{ project_name }} -d _default -p {{ solr_port }} creates=/var/solr/data/{{ project_name }}
tags:
- solr
- configure
when: "'name' not in t3_core['json']['status']['t3']"

- name: create directories needed for capistrano
become: yes
Expand Down

0 comments on commit 38db8c7

Please sign in to comment.