Skip to content

Commit 696d398

Browse files
committed
Adding an Ansible Playbook to help describe what is stored in the computate search engine
1 parent 20726ee commit 696d398

File tree

5 files changed

+45
-0
lines changed

5 files changed

+45
-0
lines changed

roles/whatis/defaults/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
---

roles/whatis/tasks/main.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
3+
- name: Query Apache Solr for all Java classes
4+
ansible.builtin.uri:
5+
url: |-
6+
https://solr-solr.apps-crc.testing/solr/computate/select?rows=0&q=*%3A*&json.facet={projects:{terms:{field:siteNom_indexed_string,%20limit:3}}}
7+
validate_certs: false
8+
register: solr_projects
9+
when: project is not defined
10+
- name: "Check for project var"
11+
ansible.builtin.debug:
12+
msg: "{{ lookup('template', 'no-project.txt').split('\n') }}"
13+
failed_when: true
14+
when: project is not defined
15+
16+
- name: Query Apache Solr for project models
17+
ansible.builtin.uri:
18+
url: |-
19+
https://solr-solr.apps-crc.testing/solr/computate/select?q=*:*&fq=partEstClasse_indexed_boolean:true&fq=classeIndexe_indexed_boolean:true&fq=classeModele_indexed_boolean:true
20+
validate_certs: false
21+
register: project_models
22+
when: class is not defined
23+
- name: "Check for project models"
24+
ansible.builtin.debug:
25+
msg: "{{ lookup('template', 'no-class.txt').split('\n') }}"
26+
failed_when: true
27+
when: class is not defined

roles/whatis/templates/no-class.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The {{ project }} project is for persisting the following types of models: {% for project_model in project_models.json.response.docs %}{% if loop.index > 1 %}, {% endif %}{{ project_model.classeNomPluriel_enUS_stored_string | default('stuff') }}{% endfor %}
2+
3+
{% for project_model in project_models.json.response.docs %}
4+
ansible-playbook whatis.yaml -e project='{{ project_model.classeNomSingulier_enUS_stored_string | default('stuff') }}'
5+
{% endfor %}

roles/whatis/templates/no-project.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
The computate project is for watching for changes in your Java projects and generating code.
2+
Learn more about any of the following projects: {% for solr_project in solr_projects.json.facets.projects.buckets %}{% if loop.index > 1 %}, {% endif %}solr_project.val{% endfor %}
3+
4+
{% for solr_project in solr_projects.json.facets.projects.buckets %}
5+
ansible-playbook whatis.yaml -e project={{ solr_project.val }}
6+
{% endfor %}

whatis.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
- name: What is this code?
3+
hosts: localhost
4+
connection: local
5+
roles:
6+
- whatis

0 commit comments

Comments
 (0)