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

roles:solr5:tasks Get and test solr cores instead of ignore=true #179

Open
JeGoi opened this issue Jul 25, 2018 · 0 comments
Open

roles:solr5:tasks Get and test solr cores instead of ignore=true #179

JeGoi opened this issue Jul 25, 2018 · 0 comments

Comments

@JeGoi
Copy link
Contributor

JeGoi commented Jul 25, 2018

https://github.com/AtlasOfLivingAustralia/ala-install/blob/master/ansible/roles/solr5/tasks/main.yml#L100 ignore: true can be replace by:

- name: Get list of Solr current cores.
  uri:
    url: "{{ solr_base_url }}/solr/admin/cores"
    return_content: yes
  register: solr_current_cores
  check_mode: no
  tags:
    - solr5
    - solr5_create_cores

- name: Create SOLR cores if not here
  get_url: url="{{ solr_base_url }}/solr/admin/cores?action=CREATE&name={{ item }}&instanceDir={{data_dir}}/solr/data/{{ item }}&config=solrconfig.xml&dataDir=data" force=yes timeout=30 dest=/tmp/
  when: "item not in solr_current_cores.content"
  with_items:
    - "biocache"
    - "bie"
    - "bie-offline"
  tags:
    - solr5
    - solr5_create_cores

Yes it's more line but the tasks is cleaner isn't it:
Before:

TASK [solr5 : Create SOLR cores] ******************************************************************************************************************************************************************************
failed: [vm-021] (item=biocache) => {"changed": false, "dest": "/tmp/", "gid": 0, "group": "root", "item": "biocache", "mode": "01777", "msg": "Request failed", "owner": "root", "response": "HTTP Error 500: Server Error", "size": 4096, "state": "directory", "status_code": 500, "uid": 0, "url": "http://vm-021:8983/solr/admin/cores?action=CREATE&name=biocache&instanceDir=/data/solr/data/biocache&config=solrconfig.xml&dataDir=data"}
failed: [vm-021] (item=bie) => {"changed": false, "dest": "/tmp/", "gid": 0, "group": "root", "item": "bie", "mode": "01777", "msg": "Request failed", "owner": "root", "response": "HTTP Error 500: Server Error", "size": 4096, "state": "directory", "status_code": 500, "uid": 0, "url": "http://vm-021:8983/solr/admin/cores?action=CREATE&name=bie&instanceDir=/data/solr/data/bie&config=solrconfig.xml&dataDir=data"}
failed: [vm-021] (item=bie-offline) => {"changed": false, "dest": "/tmp/", "gid": 0, "group": "root", "item": "bie-offline", "mode": "01777", "msg": "Request failed", "owner": "root", "response": "HTTP Error 500: Server Error", "size": 4096, "state": "directory", "status_code": 500, "uid": 0, "url": "http://vm-021:8983/solr/admin/cores?action=CREATE&name=bie-offline&instanceDir=/data/solr/data/bie-offline&config=solrconfig.xml&dataDir=data"}
...ignoring

After:

TASK [solr5 :  Get list of Solr current cores.] **************************************************************************************************************************************************************
ok: [vm-021]

TASK [solr5 : Create SOLR cores if not here] ******************************************************************************************************************************************************************
skipping: [vm-021] => (item=biocache) 
skipping: [vm-021] => (item=bie) 
skipping: [vm-021] => (item=bie-offline) 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant