add ansible-evogalaxy (tool to manage roles using ansible-roles Git repo)

This commit is contained in:
Gregory Colpart 2016-12-22 05:35:03 +01:00
parent 25818cef0a
commit 115219bf61

49
tools/ansible-evogalaxy Executable file
View file

@ -0,0 +1,49 @@
#!/bin/bash
# PoC to handle Evolix ansible-roles
# WARN: we use -b unstable for now
subcommand=$1
option=$2
sub_help(){
echo ""
echo "Usage: ansible-evogalaxy <subcommand> [options]"
echo ""
echo "Subcommands:"
echo "list"
echo "install <role>"
echo "update <role>"
echo ""
}
case $subcommand in
"help")
sub_help
;;
"list")
tmpdir=`mktemp -d`
git clone -q -b unstable https://forge.evolix.org/ansible-roles.git $tmpdir
ls -1 $tmpdir | egrep -v '(.md|.yml|Vagrant)'
;;
"install")
test -d jessie/$option && echo "error: already installed" && exit
tmpdir=`mktemp -d`
git clone -q -b unstable https://forge.evolix.org/ansible-roles.git $tmpdir
mkdir -p jessie
mv $tmpdir/$option jessie/
;;
"update")
! test -d jessie/$option && echo "error: not installed" && exit
tmpdir=`mktemp -d`
git clone -q -b unstable https://forge.evolix.org/ansible-roles.git $tmpdir
mv jessie/$option $tmpdir/$option-old
mv $tmpdir/$option jessie/
;;
*)
echo "error: unknwon command"
sub_help
;;
esac