blob: 4bbffb6b5ae46403177e3022a9f9fd3f8814b40a [file] [log] [blame]
Akron3538d8f2024-03-14 17:33:45 +01001- name: List DeReKo-KorAP Releases
2 hosts: 10.0.10.55
3 user: korap
4 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
18 (fileMeta{{ current_year }}I.name like '%2_.i5.xml' and (basename.rsr=1 or basename.inkorap=1))) and
19 fileMeta{{ current_year }}I.base=basename.id
Akron3538d8f2024-03-14 17:33:45 +010020 ORDER by name
21 register: sqlresult
Marc Kupietz42260622024-03-15 11:33:18 +010022
Akron3538d8f2024-03-14 17:33:45 +010023 - name: Find all changed from the last 200 days
24 ansible.builtin.find:
25 paths:
26 - "/vol/corpora/DeReKo/incoming/KorAP/zip/"
27 age: "-200d"
28 age_stamp: "mtime"
29 use_regex: true
30 follow: true
31 file_type: "any"
32 patterns:
33 - "^[^\\.]*\\.zip$"
34 register: newfiles
Marc Kupietz42260622024-03-15 11:33:18 +010035
Akron3538d8f2024-03-14 17:33:45 +010036 - name: Compare both lists and show intersection
37 ansible.legacy.copy:
38 content: "{{ newfiles.files | map(attribute='path') | sort() | intersect( sqlresult.query_result[0] | map(attribute='cname') ) | join('\n') }}"
39 dest: dereko-ingestion.txt
40 delegate_to: localhost