aboutsummaryrefslogtreecommitdiff
path: root/ansible/make-ssh-keys
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/make-ssh-keys')
-rwxr-xr-xansible/make-ssh-keys24
1 files changed, 24 insertions, 0 deletions
diff --git a/ansible/make-ssh-keys b/ansible/make-ssh-keys
new file mode 100755
index 0000000..fbf2b7a
--- /dev/null
+++ b/ansible/make-ssh-keys
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+set -euo pipefail
+
+hosts=(conflatorio birgitte arius)
+
+rm -rf keys
+mkdir keys
+
+out=/dev/stderr
+out=keys/keys.yml
+
+echo borg_ssh_keys: >> $out
+for host in ${hosts[@]}
+do
+ ssh-keygen -q -t ed25519 -N "" -C "borg/$host" -f keys/$host
+ echo " $host:" >> $out
+ echo " public: $(<keys/$host.pub)" >> $out
+ echo " private: |" >> $out
+ sed "s/^/ /" keys/$host >> $out
+done
+
+ansible-vault encrypt --output group_vars/all/borg_ssh_keys.yml keys/keys.yml
+rm -rf keys