From 5b3f5b1b075dcbdd6a01ee224f6118d02bdd1dfe Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 10 Aug 2022 14:15:01 +0300 Subject: [PATCH] fix nextcloud --- .drone.yml | 33 ++++++++++++++++----------------- nixos-infect | 8 +------- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/.drone.yml b/.drone.yml index 12c2f22..e3ec524 100644 --- a/.drone.yml +++ b/.drone.yml @@ -113,23 +113,22 @@ steps: from_secret: ZONE_ID commands: # Delete our machine called 'ci-sibling' and all the found DNS records on it. - - return 0 - #- > - # curl -s "https://api.hetzner.cloud/v1/servers" -H "Authorization: Bearer $PASSWORD" > .hetzner_servers.json - #- > - # export machineid=$( for i in {0..24}; do jq 'if .servers['$i'].name == "ci-sibling" then .servers['$i'].id else null end' .hetzner_servers.json; done | grep -v null | sed 's/"//g') - #- > - # curl -s -X DELETE "https://api.hetzner.cloud/v1/servers/$machineid" -H "Authorization: Bearer $PASSWORD" - #- > - # json=$(curl -X GET "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records" -H "Authorization: Bearer $CLOUDFLARE_TOKEN" -H "Content-Type: application/json") - #- > - # echo "$json" > .dns-records.json - #- > - # result=$(jq -r ".result" <<< "$json") - #- > - # echo "$ZONE_ID" - #- > - # echo "$result" | jq '.[] | "\(.id)"' | while read id ; do echo "Deleting $id"; http -v --check-status --ignore-stdin DELETE https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records/$(echo $id | cut -f 2 -d '"') Authorization:"Bearer $CLOUDFLARE_TOKEN"; done + - > + curl -s "https://api.hetzner.cloud/v1/servers" -H "Authorization: Bearer $PASSWORD" > .hetzner_servers.json + - > + export machineid=$( for i in {0..24}; do jq 'if .servers['$i'].name == "ci-sibling" then .servers['$i'].id else null end' .hetzner_servers.json; done | grep -v null | sed 's/"//g') + - > + curl -s -X DELETE "https://api.hetzner.cloud/v1/servers/$machineid" -H "Authorization: Bearer $PASSWORD" + - > + json=$(curl -X GET "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records" -H "Authorization: Bearer $CLOUDFLARE_TOKEN" -H "Content-Type: application/json") + - > + echo "$json" > .dns-records.json + - > + result=$(jq -r ".result" <<< "$json") + - > + echo "$ZONE_ID" + - > + echo "$result" | jq '.[] | "\(.id)"' | while read id ; do echo "Deleting $id"; http -v --check-status --ignore-stdin DELETE https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records/$(echo $id | cut -f 2 -d '"') Authorization:"Bearer $CLOUDFLARE_TOKEN"; done when: status: - failure diff --git a/nixos-infect b/nixos-infect index 31a203f..6270ad6 100755 --- a/nixos-infect +++ b/nixos-infect @@ -67,13 +67,7 @@ makeConf() { }, "timezone": "Europe/Uzhgorod", "resticPassword": $ESCAPED_PASSWORD, - "username": "$LUSER", - "ssh": { - "rootKeys": [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMEZ/VXDu/hN4rWE3WssSOXQaRB7wfNj7IE52CePKpo3 naiji@naiji-pc", - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE7WW3x/Xuz6IBIG8uBMvcytCOMtYkGau7x2foyoK6rc inex@inex-hp-envy" - ] - } + "username": "$LUSER" } EOF chmod 0600 /etc/nixos/userdata/userdata.json