Akron | 3538d8f | 2024-03-14 17:33:45 +0100 | [diff] [blame^] | 1 | - name: List DeReKo-KorAP Releases |
| 2 | hosts: 10.0.10.55 |
| 3 | user: korap |
| 4 | tasks: |
| 5 | - name: Receive new relevant list from database |
| 6 | community.mysql.mysql_query: |
| 7 | login_host: klinux10 |
| 8 | login_db: corpora |
| 9 | login_user: viewer |
| 10 | query: > |
| 11 | SELECT concat('/vol/corpora/DeReKo/incoming/KorAP/zip/', replace(name,'.i5.xml','.zip')) as cname |
| 12 | FROM fileMeta2024I, basename |
| 13 | WHERE (fileMeta2024I.name LIKE 'pp-%' or fileMeta2024I.rsr = 1 or |
| 14 | (fileMeta2024I.name like '%2_.i5.xml' and (basename.rsr=1 or basename.inkorap=1))) and |
| 15 | fileMeta2024I.base=basename.id |
| 16 | ORDER by name |
| 17 | register: sqlresult |
| 18 | - name: Find all changed from the last 200 days |
| 19 | ansible.builtin.find: |
| 20 | paths: |
| 21 | - "/vol/corpora/DeReKo/incoming/KorAP/zip/" |
| 22 | age: "-200d" |
| 23 | age_stamp: "mtime" |
| 24 | use_regex: true |
| 25 | follow: true |
| 26 | file_type: "any" |
| 27 | patterns: |
| 28 | - "^[^\\.]*\\.zip$" |
| 29 | register: newfiles |
| 30 | - name: Compare both lists and show intersection |
| 31 | ansible.legacy.copy: |
| 32 | content: "{{ newfiles.files | map(attribute='path') | sort() | intersect( sqlresult.query_result[0] | map(attribute='cname') ) | join('\n') }}" |
| 33 | dest: dereko-ingestion.txt |
| 34 | delegate_to: localhost |