diff --git a/ansible/host_vars/casey/main.yml b/ansible/host_vars/casey/main.yml index 04fb2a9..f5c42cb 100644 --- a/ansible/host_vars/casey/main.yml +++ b/ansible/host_vars/casey/main.yml @@ -12,4 +12,3 @@ cdn_domains: restic_backup_locations: - /var/lib/headscale/ -restic_key: "{{ vault_restic_key }}" diff --git a/ansible/host_vars/casey/vault.yml b/ansible/host_vars/casey/vault.yml index 284dd99..98c2374 100644 --- a/ansible/host_vars/casey/vault.yml +++ b/ansible/host_vars/casey/vault.yml @@ -1,14 +1,21 @@ $ANSIBLE_VAULT;1.1;AES256 -36373834643031616365396635633037316166323436353966386636346635666364356438313961 -3933656632393237353465313163326636316661626230300a326231383439323964306239366432 -30383063323065303638353064653532393463666361303962353132303762376435613264353038 -3338316334666637350a363963313730663633633036313737356263626233313766363230323564 -62646438663039343433316436386164646237663535366366656261333539366437393965613932 -37356661313130376163303339663265313666333438623962643231643961396264366331316130 -30346633363562333531373635303937383436303837396561623439346663666132313434373035 -35383534316362333439363365353836316334363239383832646264366339336664373032313733 -65353264643135356666396165316333666539663735303661353764323761633536316565653734 -39366236373463653166656466343239313238303561313131626136383739306132323538663665 -61373736656533396337656534393563316133383838666434343266636362336436633062373730 -36303139666132663834363031666233373435373233333361633863633530346263636236356238 -33353264656636626130666136663430356237336232366131336337306162313364 +65613137336266343033333338323734396266363431356166316233646663383039336634343936 +3939353039396237396432336361653838323161356330360a393962313733363734323666666361 +34303239633739383432323337356535613636376466323931323237626264333534626566386630 +3839613338316530360a396364363163623633333362636238316463313732613562386161306661 +38396361393837613137633830636333653565323331643937323863383963383739623235656636 +30393033393031393733653335633462383062613039613332653466313439366161303533366264 +39626132643534366639623230383233353332363836356132363130306637653465633663333665 +34656636316439626230663037656130346635636232336561346361396166643465313565363963 +32303962386635653264306530653132353238356336656634363136323564313261336638376136 +63306333303763633362663238396434663066386235666163383135353232633236623832356439 +62613664663164363838303531326363623465343036656530663562323231613737383464303664 +35646137373233643966323363623961393361316463313464666261653636623937646464613133 +39363863643835316330626435343166363931613430303966383263663639646463616133363463 +33346665616263666635306162383333313063636364623838306462303438373832333965633236 +61346161376161353736633332386538643839333261646432323466653962653964643438323130 +64663133346564336334653430616363643662313732356634353764613466346638353833316332 +31323364356265313263383138626234343239383063373066613666663330653431346630393937 +34636464383766623662623136636363316530643534306366616333396465636264616531363863 +33616237386132373034346132333766343030313039336531613837366265346539366264303634 +65383731656130373464 diff --git a/ansible/host_vars/restic/vault.yml b/ansible/host_vars/restic/vault.yml index 7fadbfd..3f26109 100644 --- a/ansible/host_vars/restic/vault.yml +++ b/ansible/host_vars/restic/vault.yml @@ -1,14 +1,26 @@ $ANSIBLE_VAULT;1.1;AES256 -32383134663132313532643364346432373163316165653830383962646532623961393364613630 -6533396333313566653132373539306232333762363432630a373635353338663538336431346563 -65653630646433633464373635623035356433393961303237616338323762346365363664346666 -3864383762313635640a393764633736653864656361356133333566663738313064383037343830 -31626238303532326133383163346137316430326430613735656334333935336534383538346161 -66396564643665633536313437626537666263343337323539333962653939393230633437383934 -36343032656230393764386562613239326463343931393063313161666165626434373237333134 -66383439316439343466653063303034393761303461383933306665383837383833333732336237 -37363163623236613933313963373438313037643031653465386165373036336462623436643162 -64373861633635633964373630623833323765663461326666633039396334366564336663663661 -30323437323463353437323165313362376564646533363832653430326164393765343066306664 -31303131653865383738363963353232613933353638336336633465373335323031623931396635 -3066 +37616635326362383437633735343430663563653561636338646666323631333135313465623933 +6363373730633062343966663735376666623439633139650a323537313831386537383133336461 +63353034663931363663383766653465386335383238306636666531353062316263356362386230 +3330356164373731390a363439656564666364323530363464623736313165353465346163623037 +62383238386330623662343835306563353831396666643862653965323438373332363364383333 +35343230396564343161393963666438613865316137356139393361636661373335303735323664 +36383632643534623237353562386638336533626362636363396635393533656631326337383465 +32633239643464353465626165393261323033623062313930353764386465623332613534613636 +39613563623135306232356235613862353437393062646464633732383735343362316462326561 +34346262656461643237353366303138653764363337343439656330393833333233386436646661 +62343631323035613132656665636661643162323632323363396362306266323631343161316230 +34666363383861323231353734336165393335646537326162343430653337653739376232343033 +63663731653836393232323731323965643262653836353565383261393539616536346237323166 +36633339303038613635333537393933383732303332366366326666343066316337383535333566 +65396636666238616339633839323763383732326364386138306439353030396561336262306632 +32383934383463326532363235333062363631363131616466316638366631663930366461393564 +31646330386161626463633931363439366433646439363035396364366332346339623661333562 +37633136343838666338356533643230393331636136333931653937363731623434653364393464 +31623937656231363262343366343565616134313466313835636139306164393638626263623833 +62623564396232373565393131366366383335366631373031656235326365373137613031653665 +35616265663064363832623132356365643065343830306539646635383737666231343830323261 +66633032373737653966623930386661386634316339303762383431613332643134323731636563 +34313832623430623964626139306535323139346162626332366438623630356639616630376230 +34656138323234386238373036363335353430366139363964323437623833653361613333383537 +6466 diff --git a/ansible/host_vars/tang/main.yml b/ansible/host_vars/tang/main.yml index 296508a..9b4263e 100644 --- a/ansible/host_vars/tang/main.yml +++ b/ansible/host_vars/tang/main.yml @@ -3,4 +3,3 @@ private_ip: "{{ ansible_default_ipv4.address }}" restic_backup_locations: - /var/lib/private/adguardhome/ -restic_key: "{{ vault_restic_key }}" diff --git a/ansible/host_vars/tang/vault.yml b/ansible/host_vars/tang/vault.yml index abc6c37..93e720b 100644 --- a/ansible/host_vars/tang/vault.yml +++ b/ansible/host_vars/tang/vault.yml @@ -1,14 +1,21 @@ $ANSIBLE_VAULT;1.1;AES256 -35656531393530373937613161326336373836393466323139323264633139373030353234323638 -6664363939656563363935633061656230653031396263310a306138363230643562656438613763 -63393636646437323263353565396138633539306631626135343861313131653363643662336162 -3938386431633532630a396431666464646530616530666666633466343335616463643563643637 -30366239323637373532663730336338326561666332656631616630646430616631313166366339 -32663936356232313136666131356564383232336462646565316334373763633137353566313738 -36633262663466353935316163616130623063386435633238383862616430613334376635303534 -30336661353035353430363834633532336362323265626139333137343330656630666131353139 -37633139623963373861393233316436366531643330336362613963396365323434616133323261 -30333364303535386136653863656530323634373564666238643838323836356661303862393763 -39383434643562343963626165356665613131326432643566316662343734306138363462303766 -66386230636138646434643333326438613635306633393963623835613661303932346137303164 -38386133353037356564353565636432316363616139396566663361393036306538 +66303032306566656332616563633936393036326332646664366430383635363534363037303065 +3164383833353062633336313163336364616230653338390a636234663832636666623864623464 +65373739396235383536363631326333623533613064303961333637613664386161656432613638 +3466623664326632310a363338363433323132626537396665333766366161393832663537623837 +62626166353230626334633735323164316663353936303439656336653130613963666530356630 +31346465663437663630663839613530323064383066323633363435616431346231396130383032 +32623730376363353938663834346665333133666661303162323030623462633234363139626633 +36623039363838646336623464313662333962326335653561383633306263366130366362626466 +33633366653036363935316239396161323663393263323435313032363862326637663732663839 +34663432663333666666303538623566633330313037623662616565373733636432373430333436 +65386331623439313066613437396566643062333062666437363365363134626333353332393534 +38343764383036343836346439363162363733646335616136616463396635323239636264303735 +34393533643730343432316661633736653161396161343431623862353136313035353933666537 +34346330663866323864666366363030613663643363346433303266643434643239643062303632 +30306638303534633833626532653462663337376435626533316230323638653861393130343763 +35376331333135343130303062333436643639353733653862383732363030396432386461346632 +30653230616231666665383564346565656461613561666139393234626263656137343530353136 +36376561333833633435353861336538636633633064633739313831366633633861303437306234 +39353538323563396632353936316330643961636665356439376666346135323563663631653365 +35633533643731373861 diff --git a/ansible/host_vars/walker/main.yml b/ansible/host_vars/walker/main.yml index 1d13ac1..3048056 100644 --- a/ansible/host_vars/walker/main.yml +++ b/ansible/host_vars/walker/main.yml @@ -2,7 +2,6 @@ private_ip: "{{ ansible_tailscale0.ipv4.address }}" restic_backup_locations: - /opt -restic_key: "{{ vault_restic_key }}" nginx_https_redirect: true diff --git a/ansible/host_vars/walker/vault.yml b/ansible/host_vars/walker/vault.yml index 9d4bebc..067b1e8 100644 --- a/ansible/host_vars/walker/vault.yml +++ b/ansible/host_vars/walker/vault.yml @@ -1,18 +1,25 @@ $ANSIBLE_VAULT;1.1;AES256 -34613565386261353635353661303237356565326639653231353365383664656162323438663637 -3964636331333465393939353934363436636631396262620a613134393263373431306161313730 -62323666323064356335313062306133393839373636643137666264343535653062313661636634 -3935376666303364660a333532623636313765383134316561373938613237373737323366383264 -65346533616132303931393639313865313235613661333039303339326435346465346661386130 -33303736333337616430363030363866386561333434373038343462353430323933353037303236 -37346639666661393432323866653232303134343261646566323437613066323566313463656266 -32336466623065316432643839643534373738313538333363636636323036616362633631316365 -35663064313833373466643036393562343261663339303336663534663230343230313566383930 -62356636326266653961363062636635303738326664656535306566663239646332376261623764 -36323030636134656138646636336162313461386339636435623361333333613661366530363937 -36376261653061663230623765366330366361663362356266376632653133316437643961373862 -37356262383466326236393464666665626336616262306230663266303464376361396336373732 -64636535666332333035393931306466343366623737636562613662373933643532383863653462 -62333839613239613965303031613636373166306662663665383439383837326163376463363937 -61396161636565613437623061383834656435303634616335636166343139623662356662313831 -62343961313230323330393137646662376363616661633365303738373164306564 +61616639316338623739306163363831303664633965666134373335353038323065306538303465 +3462346437303139393738613031363637383731333438630a393862353436376264386264626531 +37326431643130373566633431313431653538636662623135386364373634373761303365646564 +3735633436323231390a386661336431656266616136626261373132393862386163396336643366 +31366463656363363363666438653762653332313336303561313961393236613065303966386535 +34396239366138613330366361323562663132343762333536646131643466643533303163636139 +34626135613731653033313236386162613037386464613531633063656564336566386461666639 +65653635326232643937313465343763326464613231383932393262323062316136353538626464 +31383361643164303330653531333439613665313136393833366334323931373963313033646163 +37363231616232353565636634646235383564356461393831323430363965333265656166363265 +62353130323939313931316430393636336634323930376337373130363362396561373835633731 +30383633333864623336353937623438616562346361626333306162626331326635363365353939 +32636637396461396662626633323034383034353630633565363439636261333063306638373063 +63363932623635393465336132343337633765646339376638326635373930353734666461636538 +39613538313462633836343664333034326436336139343865643135383736656132343866663263 +64323562383963396237383537306261643331646533616233326435386164336237316462623438 +30623662303835653039393739396535613264373031336637616165333837343939363564613339 +37633831653361373038643438623732323535653230626364653936383736363364313632656538 +63646361323733656362366433353136643038643039633231326638346636653861616437653562 +65343237623039386339326564316333636362376266316661333632313034366565383139323564 +30343531333038323438393461326335386439373365323031366562363966616437616265386234 +33646562626564386639376130623366303063313739343435656434356230636630333834666433 +35663035663137666537633335613737383563356266336433396531366166313435653934663433 +63646162663563643962 diff --git a/ansible/roles/restic/defaults/main.yml b/ansible/roles/restic/defaults/main.yml index a237ac2..1f3d3bd 100644 --- a/ansible/roles/restic/defaults/main.yml +++ b/ansible/roles/restic/defaults/main.yml @@ -1,28 +1,3 @@ restic_backup_locations: [] restic_backup_excludes: [] restic_dir: "{{ hostname_slug }}" -restic_b2_account_id: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 37653465353462333831333031373566343362316461643463303737356332363364666264666562 - 6436353430313239643831626537383664376264393430310a353434306465653934356164393265 - 65336534356636386634366533313039643438656439636434666464636338373130636661303536 - 6638356530373062640a376430663231396538386161353165363538346266663135363337303166 - 35613838363336393032643965373437663937626532356239336535663064363438 -restic_b2_account_key: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 31343939356266366364313631633836653364633331306134663163653939373663316632626161 - 3262376666323366313563313836643133393437663462320a653637633663636663353234323265 - 63633632383461616437636230643430613635626431383966326666383030393735623963333263 - 3433633830356530390a623436376364343630313066663965303238646564323266303865623965 - 66353963376434333030333332646464653637633737633832663762303339666336 -restic_key: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 65326130653631643138373231336439303962356666353737373832633666373965666466613034 - 3730333664373334316436396435356137313337633836330a653366343732656539663439313838 - 34326361353232663533663366393464643761343864623965386633313438303738343238623430 - 6661313730646166330a393336333635623832653232653863626135343164363831366134316465 - 30306238613865393664383865323233626636333063393936613864303365386431613838366363 - 39633865393761366134633933333237313362636234323330313135336637613235303764383938 - 34383938396366363937643864393838363638383066646663393363393562653431653764356537 - 61303164333662353732656265386430383566343462633435626334373331316663363563616662 - 66643135336539333738623231346331623464636637373639666435663961383936 diff --git a/ansible/roles/restic/files/backrest.sh b/ansible/roles/restic/files/backrest.sh index 8b587b8..d41161b 100644 --- a/ansible/roles/restic/files/backrest.sh +++ b/ansible/roles/restic/files/backrest.sh @@ -2,9 +2,9 @@ set -e -export AWS_ACCESS_KEY_ID="{{ restic_b2_account_id }}" -export AWS_SECRET_ACCESS_KEY="{{ restic_b2_account_key }}" -export RESTIC_PASSWORD="{{ restic_key }}" +export AWS_ACCESS_KEY_ID="{{ vault_restic_b2_application_key_id }}" +export AWS_SECRET_ACCESS_KEY="{{ vault_restic_b2_application_key }}" +export RESTIC_PASSWORD="{{ vault_restic_key }}" export RESTIC_REPOSITORY="s3:{{ restic_b2_endpoint }}/{{ restic_b2_bucket }}/{{ restic_dir }}" export GOGC=20 # HACK: Work around for restic's high memory usage https://github.com/restic/restic/issues/1988 diff --git a/terraform/backblaze.tf b/terraform/backblaze.tf index f3210b5..98e5f76 100644 --- a/terraform/backblaze.tf +++ b/terraform/backblaze.tf @@ -64,6 +64,25 @@ resource "b2_application_key" "restic" { ] } +resource "b2_application_key" "restic_repos" { + for_each = toset(["walker", "tang", "casey"]) + + key_name = "restic-${each.key}" + bucket_id = b2_bucket.restic.id + name_prefix = "${each.key}/" + capabilities = [ + "readFiles", + "deleteFiles", + "listBuckets", + "listFiles", + "readBucketEncryption", + "readBuckets", + "shareFiles", + "writeBucketEncryption", + "writeFiles", + ] +} + resource "b2_application_key" "infrastructure" { key_name = "infrastructure" capabilities = [