Compare commits

...

2 Commits

Author SHA1 Message Date
Jef Roosens b5e9afe5a4
ntfy: integrate notifications into backup script 2024-01-20 14:30:09 +01:00
Jef Roosens 9b29e68378
ntfy: also install on ruby 2024-01-20 13:36:24 +01:00
6 changed files with 85 additions and 50 deletions

View File

@ -20,3 +20,5 @@ woodpecker_server: 'ci.rustybever.be:9000'
woodpecker_secret: "{{ vault_woodpecker_secret }}" woodpecker_secret: "{{ vault_woodpecker_secret }}"
restic_version: '0.16.2' restic_version: '0.16.2'
ntfy_user_pi_pass: "{{ vault_ntfy_user_pi_pass }}"

View File

@ -1,10 +1,14 @@
$ANSIBLE_VAULT;1.1;AES256 $ANSIBLE_VAULT;1.1;AES256
65396664323038303134303832613939623230323365613162313835623462663137623231643466 35353730613932643733343565323332383038383461626535616166616338653066306533366164
3661303536326134636662636237326337653535613565380a643035326434656334363432633037 6261353438653937326264623632363336633039383361620a333239333937663561613162376161
31626233633935616234376334336138353833613962653632313639383932613638316238636436 30393966656236656634633035643336626538373733643863613864373439363564376563613361
3066656463396530340a356634316630363866373834393035336663373264613031646231666538 3666616235623631370a373439393839313336323466306461373534626661616231333436326663
63366666336236313236653831316433346335356430366364303739666532623835373931376636 37616638353830323865356236363937313033643563646466366432623762393539386334623938
63386434346265626331306461393330316164396632383462613537343664616266643938646632 63303331363165313437383061353037313536333132393439653538316264376362336466313231
66316362623730313039666161353232313265613463653762666533356532633333616631343235 66313530313937373232613534343065626534666136326233626137353631386161653133643933
66646339643366663365323165383830353562643266353935386334383134623933353162653666 37356237643362643161383131623035373037653139643331663435623162323566643635353731
6432 62663165383465656432613339353466313437323365393766313865323565623138363537356561
31623565353362356464376637386633373133333365336662346331633236383934623638366662
31326264306434633532373131303839613735343364613232306164316661313933636235633161
37346630333565313636333435323635663962376636366437383938663763366433366230376636
3431

View File

@ -1,35 +1,32 @@
$ANSIBLE_VAULT;1.1;AES256 $ANSIBLE_VAULT;1.1;AES256
62346334613664653131343434626663336631396537393434353165616236306339376365656539 30653235356365303661373234343761643338633930316436373463633164393230663264616633
6435616564373934616339363363333431313531336262350a373137646264636364333464336230 3638313463653234326466653836343437393036323839330a353033346131383734353435393839
30613464636139363061376563333563383634653564623264633133613337663465653633323830 63396133333861623739353136386263323031613862343833623535396135366361643532363861
3232343731636135340a316263363633373038393261346637623333616137303662613132623661 3830663635323936330a323663643931643234346636623930353533363166613237366538393734
66363736356631316231303262356531326663333566313832346165323863376236393335363130 64666638383862343763636466353134646632376162643330646362306531336431383533313933
39393262623633646230656130316461396530646565353234663766356563326338613261313832 66346139346138326663396237346661626434643165656664616436366537363361393535323262
33373232333231333666366564396562383034353961393262646231626632396135373265303066 35356339323635343739353931386638373836613032343134366431353164663461636430303363
61613131323762363635633939666464633730376538323538313339306464643036656337393633 35313261316662383661353932646331663063306337663130663933663566343966306338373163
64386439636665366630633462623530663833326438613433306134373966393130343438323334 33386534313231643363373165623065353264393539316339373163626363316562373034636435
33366530373831326533303632373564376463643439633538653039373464386433663037346535 63643961623639366461323133386337643365353634663630666632376366633730616163653338
61326430393662353732383231663632363433333565373136633930623533343061366639333262 37663635623563363932663739373435316335666539393930313066666565646531393730656332
32613435363232346131393862663066663539323334326566356235626565333831393066343731 31653631363261663338336362653830356635376433666537356433323839323030626636653639
36356539326632666665633166363135313139646136373934613561323531393533643131333963 37393237613465313231396264393339653164316432376364373737633731646431386135356438
66613561343864353937386632376330346666626262303166353838333966366239363363656335 31616139633062376262396337396234303065663238326363316130323533343565343366376361
39393163616133316531356339623933633237393663323630386363636163636136383334343230 62353739653735393637353938313261653533336237393333333930656637663662643162616662
39326431663232303835656632373035623531656131383763323536383433343131363239343536 35636437393133616230373437653766393361613535353633373866383431393862623135383738
31643364613031386162656236373635303235303262393239396138393061313331333436663663 33623433396538366362633131353834353164363165356561313238653631343430656163383761
36613963343262346131643263373937653264626230373737643935386338343434613434663061 61336364653230333138363630616130623132333539353534323465663833626563343864626638
36396265336466306437383664653731343838396663396233393663656138363932323563326631 34353064626538383734303436306639666239363536313062343239656136313466343366393964
62363332613261383637653861346338626531353330346532303066623638376663366133313532 37663864346534346131643362646662316234643263306166313334626564356565353966383961
63623930303363333162373562323334373332346335303065643536396565626534316537376466 64343630396637613130643436326564383533323134323066373039303533323261656164303862
64663266396238653165346134363432386532323534373366643233373366316365323938313661 39396530343534383837383664363235613939663765616663383031643839643939313839643437
36346362646430623563376261306265623663326534373562636633303835333330613761326264 35323831633231613364356134633535396333643862343531333965366135323631323764336264
33353264316238663134346463333033346564653137646336373134623134633534343333366262 63393330613532643831623364396234613539353735633539626635393038656437316465616535
37646166623463323436363436386539343061646230626638313537643862316338383939316233 61353730623735356535313438366332633233666631643531323135323864346565613066376238
62333535663338346663363334386538366437393161356639306636393232396562303366383232 39393834633263633566343539663765656266313637303565663465663139343565643962656637
64313762363436333262396631663331333033356362373764373732313330396237383864316638 32303464353031323039346533616433613862336630313139646665323931396335306134633531
34306563646633366666343535346630616632343033343036393232376264653831373664356361 66396262353363383565643434393438633232376431616465623038656463346237373038656164
66333737343731393837633432383862326532336434326461313439653763613062343331646639 61373262626634633335323163636366336134613663643039373530373538383134323631623438
38376536306532623834336435353962323635383930323435376234316230636533353264626663 34636364653463656536336462613962386339616365373533356161633132383532303264383565
38306366316534383530613131346163613765326534396231373932303639393430656233363234 646335383665303262623363613532643738
63643133623637326466623765653638383437343035343035653766333036373334343961326534
32303665336130346636616564613332393235303034643939643635346662316466356535653331
3265353466356535346632623363373037303861346135613066

14
nas.yml
View File

@ -7,13 +7,6 @@
- common - common
tags: base tags: base
- hosts: nas
become: yes
roles:
- ntfy
- ntfy-server
tags: ntfy
- name: Configure BTRFS RAID - name: Configure BTRFS RAID
hosts: nas hosts: nas
become: yes become: yes
@ -21,6 +14,13 @@
- raid - raid
tags: raid tags: raid
- hosts: nas
become: yes
roles:
- ntfy
- ntfy-server
tags: ntfy
- name: Set up Samba - name: Set up Samba
hosts: nas hosts: nas
become: yes become: yes

View File

@ -8,10 +8,36 @@
export RESTIC_REPOSITORY='rest:http://{{ groups['nas'][0] }}:8000/backups' export RESTIC_REPOSITORY='rest:http://{{ groups['nas'][0] }}:8000/backups'
export RESTIC_PASSWORD_FILE='/etc/backups/restic_backups_passwd' export RESTIC_PASSWORD_FILE='/etc/backups/restic_backups_passwd'
log_file='/tmp/backup-all.sh.log'
rm -f "$log_file"
for script in $(find /etc/backups -name '*.backup.sh'); do for script in $(find /etc/backups -name '*.backup.sh'); do
T="$(date +%s)"
/usr/bin/bash "$script" /usr/bin/bash "$script"
res="$?"
T="$(($(date +%s)-T))"
if [[ $res == 0 ]]; then
header='OK'
else
header="FAIL ($res)"
fi
printf \
"%s: %s in %02dh%02dm%02ds\n" \
"$(basename "$script")" "$header" \
"$((T/3600%24))" "$((T/60%60))" "$((T%60))" \
>> "$log_file"
done done
# Prune older backups # Prune older backups
/usr/local/bin/restic forget --keep-last 7 && \ /usr/local/bin/restic forget --keep-last 7 && \
/usr/local/bin/restic prune /usr/local/bin/restic prune
# Send status notification
ntfy publish \
--title "Backups ($(hostname))" \
homelab "$(cat "$log_file")"

View File

@ -13,6 +13,12 @@
- ruby - ruby
tags: ruby tags: ruby
- hosts: ruby
become: yes
roles:
- ntfy
tags: ntfy
- name: Install Woodpecker agent - name: Install Woodpecker agent
hosts: ruby hosts: ruby
become: yes become: yes