From 2a1a97c5e39db7f78e7804b7b4e4bf5af52b9326 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 30 Nov 2024 18:02:01 +0100 Subject: [PATCH] add ynab-go --- playbooks/apps/templates/ynab/run-go.j2 | 4 ++ playbooks/apps/ynab.yaml | 51 ++++++++++++++++++++++++- playbooks/system/cron.yaml | 2 +- 3 files changed, 54 insertions(+), 3 deletions(-) create mode 100755 playbooks/apps/templates/ynab/run-go.j2 diff --git a/playbooks/apps/templates/ynab/run-go.j2 b/playbooks/apps/templates/ynab/run-go.j2 new file mode 100755 index 0000000..b5dc6be --- /dev/null +++ b/playbooks/apps/templates/ynab/run-go.j2 @@ -0,0 +1,4 @@ +#!/bin/bash +set -euo pipefail +./download -i {{lcl_identifier}} -p {{lcl_password}} -o out.csv -headless +./push -t {{ynab_token}} -b {{ynab_budget_id}} -a {{ynab_account_id}} -f out.csv diff --git a/playbooks/apps/ynab.yaml b/playbooks/apps/ynab.yaml index cab1675..34c483b 100644 --- a/playbooks/apps/ynab.yaml +++ b/playbooks/apps/ynab.yaml @@ -16,9 +16,56 @@ with_fileglob: - files/{{ app_name }}/* - files/{{ app_name }}/.* - notify: - - Restart service + - name: Template ynab files + ansible.builtin.template: + src: "{{ item }}" + dest: /mnt/data/ynab/{{ item | basename | regex_replace('\.j2$', '') }} + mode: preserve + with_fileglob: + - templates/ynab/*.j2 + loop_control: + label: "{{ item | basename }}" vars: app_name: ynab dir: /mnt/data/{{ app_name }} + lcl_identifier: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 61656566333163306638626338653665326238363861363166636434386237646332376466356239 + 3232316637313266303438376563633363323838613035360a343032643239636539636264306536 + 65323734393563643065383663313033643733666365653539346239396461643136343835333334 + 3564346563386337610a353538393862353438613233373661353631326139663065366463626132 + 6537 + lcl_password: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 62363534396534663536316461666565356462666564643162643364663835356230323233386165 + 3639393736303662346135353236623363306264636561650a393063346239363030363130636137 + 33343039643932613834376131626665643737306433316562373238663332326231643830396539 + 6465613462623065370a376439336338306333613038353865323537303439333831373062626537 + 6563 + ynab_token: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 38663565353834633363303766613132663963353863373837616634643430653732383139316432 + 3862616565373734363330353464383064333235316534330a303638383062336165613030666231 + 36376331623231663466323065623030666133616130376639363430623065303663633361353764 + 3366373866343638630a383466396662383632396238626466616239333632633362393366626365 + 31393332613134363037363931306465646230356634353539366438643336643363333133626434 + 35333932663865316438393932373332623434653431356264336566613834376139616662616434 + 61656639333036333539316361353032313239613331386266353764343363656438306462323338 + 38386238343131383338 + ynab_account_id: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 63646338376535393861353732333262336630363935646239303232313337386134393632626431 + 3433623138613366616662643764353266643061393739370a663839616265356462656166636137 + 31653534613565323336653161613361396635326361313562313764353262636333306263613232 + 3831643861666536340a393861363032616663383062333535633636363538303332666563346363 + 61666135613264356335326364366631646165323661656530393166383165353562646564306432 + 3162663936653930306361343465383331633436653431653765 + ynab_budget_id: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 30616437653535643734303064636436313330653430326137616533616634643762613636613737 + 3035626137636434303236353261623939386364383739610a363536633230343564386333363465 + 35373963376238363837383165626366363739356337353039343662626438343336353533636537 + 6634393231313632350a366432666137396264393933363062613430633133393835663765663861 + 36373833656562393830323535653337383135613538356262323033643930343564396461666462 + 6331393437306161383537626462393239313363346163343765 diff --git a/playbooks/system/cron.yaml b/playbooks/system/cron.yaml index 15e1704..382ff3a 100644 --- a/playbooks/system/cron.yaml +++ b/playbooks/system/cron.yaml @@ -22,7 +22,7 @@ minute: 50 hour: 6 weekday: TUE-SAT - job: /mnt/data/bin/healthcheck ynab /mnt/data/ynab/run + job: /mnt/data/bin/healthcheck ynab /mnt/data/ynab/run-go - name: Cron - Nextcloud cron ansible.builtin.cron: name: Nextcloud cron