Skip to content

Commit

Permalink
Adding an Ansible Playbook to help describe what is stored in the com…
Browse files Browse the repository at this point in the history
…putate search engine
  • Loading branch information
computate committed Sep 25, 2023
1 parent 20726ee commit 696d398
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions roles/whatis/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---
27 changes: 27 additions & 0 deletions roles/whatis/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---

- name: Query Apache Solr for all Java classes
ansible.builtin.uri:
url: |-
https://solr-solr.apps-crc.testing/solr/computate/select?rows=0&q=*%3A*&json.facet={projects:{terms:{field:siteNom_indexed_string,%20limit:3}}}
validate_certs: false
register: solr_projects
when: project is not defined
- name: "Check for project var"
ansible.builtin.debug:
msg: "{{ lookup('template', 'no-project.txt').split('\n') }}"
failed_when: true
when: project is not defined

- name: Query Apache Solr for project models
ansible.builtin.uri:
url: |-
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
validate_certs: false
register: project_models
when: class is not defined
- name: "Check for project models"
ansible.builtin.debug:
msg: "{{ lookup('template', 'no-class.txt').split('\n') }}"
failed_when: true
when: class is not defined
5 changes: 5 additions & 0 deletions roles/whatis/templates/no-class.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
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 %}

{% for project_model in project_models.json.response.docs %}
ansible-playbook whatis.yaml -e project='{{ project_model.classeNomSingulier_enUS_stored_string | default('stuff') }}'
{% endfor %}
6 changes: 6 additions & 0 deletions roles/whatis/templates/no-project.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The computate project is for watching for changes in your Java projects and generating code.
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 %}

{% for solr_project in solr_projects.json.facets.projects.buckets %}
ansible-playbook whatis.yaml -e project={{ solr_project.val }}
{% endfor %}
6 changes: 6 additions & 0 deletions whatis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: What is this code?
hosts: localhost
connection: local
roles:
- whatis

0 comments on commit 696d398

Please sign in to comment.