39 lines
840 B
Bash
Executable file
39 lines
840 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# This script will bootstrap the machine using Ansible
|
|
# Copyright (C) 2018 Elijah Lazkani
|
|
|
|
playbook=$1
|
|
|
|
function _find_ansible() {
|
|
|
|
command ansible-playbook -h > /dev/null 2>&1
|
|
if [[ $? -ne 0 ]];
|
|
then
|
|
echo "Ansible not found..."
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
function _ansible () {
|
|
|
|
_find_ansible
|
|
|
|
echo "Bootstrapping Ansible"
|
|
if [[ $playbook ]];
|
|
then
|
|
if [ ! -f inventory ];
|
|
then
|
|
echo "Inventory file not found"
|
|
touch inventory
|
|
fi
|
|
|
|
echo "Sit down, relax and kick your legs up, fun is about to begin..."
|
|
ansible-playbook -i inventory Ansible/$playbook --ask-sudo-pass
|
|
else
|
|
echo "Choose a profile to run from the list below:"
|
|
find Ansible/ -maxdepth 1 -name "*.yml" -type f -printf " - %f\n"
|
|
fi
|
|
}
|
|
|
|
_ansible
|