Use resp. current year instead of hard coded 2024
Change-Id: Ib727321e3f88006131e85ac0089bc370acc4352d
diff --git a/list-dereko-korap-release.yml b/list-dereko-korap-release.yml
index 2f90a5a..4bbffb6 100644
--- a/list-dereko-korap-release.yml
+++ b/list-dereko-korap-release.yml
@@ -2,6 +2,10 @@
hosts: 10.0.10.55
user: korap
tasks:
+ - name: Get current year
+ set_fact:
+ current_year: "{{ ansible_date_time.year }}"
+
- name: Receive new relevant list from database
community.mysql.mysql_query:
login_host: klinux10
@@ -9,12 +13,13 @@
login_user: viewer
query: >
SELECT concat('/vol/corpora/DeReKo/incoming/KorAP/zip/', replace(name,'.i5.xml','.zip')) as cname
- FROM fileMeta2024I, basename
- WHERE (fileMeta2024I.name LIKE 'pp-%' or fileMeta2024I.rsr = 1 or
- (fileMeta2024I.name like '%2_.i5.xml' and (basename.rsr=1 or basename.inkorap=1))) and
- fileMeta2024I.base=basename.id
+ FROM fileMeta{{ current_year }}I, basename
+ WHERE (fileMeta{{ current_year }}I.name LIKE 'pp-%' or fileMeta{{ current_year }}I.rsr = 1 or
+ (fileMeta{{ current_year }}I.name like '%2_.i5.xml' and (basename.rsr=1 or basename.inkorap=1))) and
+ fileMeta{{ current_year }}I.base=basename.id
ORDER by name
register: sqlresult
+
- name: Find all changed from the last 200 days
ansible.builtin.find:
paths:
@@ -27,6 +32,7 @@
patterns:
- "^[^\\.]*\\.zip$"
register: newfiles
+
- name: Compare both lists and show intersection
ansible.legacy.copy:
content: "{{ newfiles.files | map(attribute='path') | sort() | intersect( sqlresult.query_result[0] | map(attribute='cname') ) | join('\n') }}"