blob: 6271f7d2ef50ef9caeeacfa6871a8ad6b01c6832 [file] [log] [blame]
- name: generate-okk-vc
hosts: worker-03
run_once: true
tasks:
- name: Get current year
set_fact:
current_year: "{{ ansible_date_time.year }}"
- name: Receive OKK list from database
community.mysql.mysql_query:
login_host: klinux10
login_db: corpora
login_user: viewer
query: >
SELECT upper(replace(name,'.i5.xml','')) as sname
FROM fileMeta{{ current_year }}I, basename
WHERE fileMeta{{ current_year }}I.base=basename.id
AND basename.rsr
AND fileMeta{{ current_year }}I.name NOT REGEXP '([4-8][0-9]|90|91|92|93|94)'
ORDER BY sname;
register: sqlresult
- name: Convert result to KoralQuery
ansible.builtin.command:
cmd: "cosmasvc2koralquery -" # | gzip -vc
stdin: "{{ sqlresult.query_result[0] | map(attribute='sname') | join('\n') }}"
stdin_add_newline: true
register: generated_vc
- name: Copy KoralQuery to localhost
ansible.legacy.copy:
content: "{{ generated_vc.stdout }}"
dest: ratskorpus-{{ current_year }}.jsonld
delegate_to: localhost