blob: c723312394810815edac3625cd5114d43d8d70da [file] [log] [blame]
Akron3538d8f2024-03-14 17:33:45 +01001- name: List DeReKo-KorAP Releases
Akron6c26c6a2024-03-19 14:19:53 +01002 hosts: worker-03
3 run_once: true
Akron3538d8f2024-03-14 17:33:45 +01004 tasks:
Marc Kupietz42260622024-03-15 11:33:18 +01005 - name: Get current year
6 set_fact:
7 current_year: "{{ ansible_date_time.year }}"
8
Akron3538d8f2024-03-14 17:33:45 +01009 - name: Receive new relevant list from database
10 community.mysql.mysql_query:
11 login_host: klinux10
12 login_db: corpora
13 login_user: viewer
14 query: >
15 SELECT concat('/vol/corpora/DeReKo/incoming/KorAP/zip/', replace(name,'.i5.xml','.zip')) as cname
Marc Kupietz42260622024-03-15 11:33:18 +010016 FROM fileMeta{{ current_year }}I, basename
17 WHERE (fileMeta{{ current_year }}I.name LIKE 'pp-%' or fileMeta{{ current_year }}I.rsr = 1 or
Marc Kupietzbdd87e12024-03-25 19:50:24 +010018 fileMeta{{ current_year }}I.main = 1 or
Marc Kupietz42260622024-03-15 11:33:18 +010019 (fileMeta{{ current_year }}I.name like '%2_.i5.xml' and (basename.rsr=1 or basename.inkorap=1))) and
20 fileMeta{{ current_year }}I.base=basename.id
Akron3538d8f2024-03-14 17:33:45 +010021 ORDER by name
22 register: sqlresult
Marc Kupietz42260622024-03-15 11:33:18 +010023
Akron3538d8f2024-03-14 17:33:45 +010024 - name: Find all changed from the last 200 days
25 ansible.builtin.find:
26 paths:
27 - "/vol/corpora/DeReKo/incoming/KorAP/zip/"
28 age: "-200d"
29 age_stamp: "mtime"
30 use_regex: true
31 follow: true
32 file_type: "any"
33 patterns:
34 - "^[^\\.]*\\.zip$"
35 register: newfiles
Marc Kupietz42260622024-03-15 11:33:18 +010036
Akron3538d8f2024-03-14 17:33:45 +010037 - name: Compare both lists and show intersection
38 ansible.legacy.copy:
39 content: "{{ newfiles.files | map(attribute='path') | sort() | intersect( sqlresult.query_result[0] | map(attribute='cname') ) | join('\n') }}"
40 dest: dereko-ingestion.txt
41 delegate_to: localhost