generated from netr0m/ansible-role-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wireguard): add util to print configs (#27)
- Loading branch information
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#! /usr/bin/env bash | ||
|
||
# util to print QR codes for wireguard configs | ||
# requires 'jq' and 'qrencode' to be installed | ||
|
||
if ! command -v jq &> /dev/null; then | ||
echo "Missing required package 'jq'" | ||
exit 1 | ||
elif ! command -v qrencode &> /dev/null; then | ||
echo "Missing required package 'qrencode'" | ||
exit 1 | ||
fi | ||
|
||
for wgcfg in $(docker volume inspect {{ infra_wireguard_volume_name_config }} | jq '.[].Mountpoint' | sed 's/"//g')/peer_*/peer_*.conf; do | ||
echo $(basename "$wgcfg") | ||
qrencode -t ansiutf8 < "$wgcfg" | ||
done |