routerbackup külön csomagba
This commit is contained in:
parent
21f9406072
commit
f9ffcbc507
40
routerbackup
40
routerbackup
@ -1,40 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
BACKUP=0
|
||||
CHECK=0
|
||||
while getopts "bc" opt; do
|
||||
case $opt in
|
||||
b)
|
||||
BACKUP=1
|
||||
;;
|
||||
c)
|
||||
CHECK=1
|
||||
;;
|
||||
\?)
|
||||
echo "usage: $0 [-c] [-f]" >&2
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ $BACKUP = 0 && $CHECK = 0 ]]; then
|
||||
echo "no action" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
outfilter=$(dirname $0)/ansible_outfilter
|
||||
|
||||
if [[ $BACKUP > 0 ]]; then
|
||||
DIFF=/tmp/routerbackup.diff.$$
|
||||
ansible-playbook -e routerbackup_diff=$DIFF routerbackup.yml | $outfilter
|
||||
cat $DIFF
|
||||
rm -f $DIFF
|
||||
fi
|
||||
|
||||
if [[ $CHECK > 0 ]]; then
|
||||
CHECKFILE=/tmp/routerbackup.check.$$
|
||||
ansible-playbook -t check -e routerbackup_checkfile=$CHECKFILE routerbackup.yml | $outfilter
|
||||
cat $CHECKFILE
|
||||
rm -f $CHECKFILE
|
||||
fi
|
||||
|
||||
# vim: set tabstop=4 shiftwidth=4 expandtab smarttab:
|
||||
Loading…
x
Reference in New Issue
Block a user