ansible-desktop/deploy.sh

33 lines
539 B
Bash
Executable file

#!/bin/sh
set -eu
cd "$(dirname "$0")"
UPDATE=true
if [ $# -eq 1 ] && [ "$1" = "-n" ]; then
UPDATE=false
shift
fi
if [ $# -gt 0 ]; then
echo "Usage: $(basename "$0") [-n]" 1>&2
exit 1
fi
# run sudo to cache creds
sudo /bin/true
# update modules and check depencies
if "$UPDATE" ; then
git pull
fi
if "$UPDATE" || [ ! -f roles/.git ]; then
git submodule update --init --recursive
fi
if ! rpm -q ansible > /dev/null; then
sudo dnf -y install ansible
fi
# run playbook
ansible-playbook playbooks/deploy.yml