home-server/tools/graphviz_roles.sh

18 lines
564 B
Bash
Executable File

#!/bin/bash
# The home-server project produces a multi-purpose setup using Ansible.
# Copyright © 2018 Y. Gablin, under the GPL-3.0-or-later license.
# Full licensing information in the LICENSE file, or gnu.org/licences/gpl-3.0.txt if the file is missing.
cd "$(dirname "$0")/../roles"
{
printf 'digraph roles {\noverlap=scale;\n'
for r in *; do
sed -rn "s/.*- role: (.*)/$r -> \\1;/p" $r/meta*/main.yml 2>/dev/null
done
echo '}'
} | tr . _ >../roles.dot
cd ..
dot -Tpdf roles.dot >dot.pdf
twopi -Tpdf roles.dot >twopi.pdf
circo -Tpdf roles.dot >circo.pdf