path: root/ansible/
diff options
authorSrdjan Grubor <>2014-01-14 15:11:36 -0600
committerSrdjan Grubor <>2014-01-16 21:46:33 -0600
commit5214ed7a373ef9bea7c2028cbe60e264449da812 (patch)
tree5b1a5a0a0516824a816b96f7d1b3e650b77c3118 /ansible/
parenta70540d2e6bff081f8d97686320597680960c799 (diff)
Initial addition of ansible scripts
Diffstat (limited to 'ansible/')
1 files changed, 40 insertions, 0 deletions
diff --git a/ansible/ b/ansible/
new file mode 100755
index 0000000..9387570
--- /dev/null
+++ b/ansible/
@@ -0,0 +1,40 @@
+#!/bin/bash -e
+echo "To run this script, you need to have the following"
+echo " - VM running with the correct dev HD image"
+echo " - A user defined with sudo privileges"
+echo " - sshpass installed on the local machine"
+read -p "Press [Enter] to continue..."
+if [[ ! $(which sshpass) ]]; then
+ echo "sshpass not found. Exiting"
+ echo "You can install it with sudo apt-get install sshpass"
+ exit 1
+read -e -p "Enter your machine's IP: " -i "$DEFAULT_IP" TARGET_IP
+read -e -p "Enter your machine's user: " -i "$DEFAULT_USER" TARGET_USER
+read -e -p "Enter your machine's password: " -i "${DEFAULT_PASSWORD}" TARGET_PASS
+echo -n "Checking connectivity to machine..."
+sshpass -p "${TARGET_PASS}" ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $TARGET_USER@$TARGET_IP 'uname -a' &> /dev/null
+echo "[OK]"
+trap "rm -f $tmp_inventory" EXIT
+echo "Creating Ansible inventory file in $tmp_inventory"
+cat << EOF > $tmp_inventory
+dev_machine ansible_ssh_host=$TARGET_IP ansible_ssh_user="$TARGET_USER" ansible_ssh_pass="${TARGET_PASS}" ansible_connection=ssh
+ansible-playbook -i $tmp_inventory playbooks/setup_dev_machine.yaml