From c8ac231ca384bd765933c8f4bdf9cd58aa360e7a Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Fri, 15 Dec 2017 20:00:38 +0100 Subject: [PATCH] add run script for easier setup --- README.md | 13 +++++++------ run.sh | 36 ++++++++++++++++++++++++++++++++++++ setup.sh | 6 ------ 3 files changed, 43 insertions(+), 12 deletions(-) create mode 100755 run.sh delete mode 100755 setup.sh diff --git a/README.md b/README.md index 9a79c08..05b08fd 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,15 @@ Basic starter kit to create your own provisioning ## Quick start -1. Clone this repo `git clone https://github.com/personal-provisioning/starterkit.git` -2. Delete the git folder `rm -rf .git/` -3. Init git again `git init` -4. Run `setup.sh` +1. Setup the directory strucutre: `mkdir -p ~/.personal_provisioning` +2. Clone this repo `git clone https://github.com/personal-provisioning/starterkit.git ~/.personal_provisioning/config` +3. Delete the git folder `rm -rf .git/` +4. Init git again `git init` 5. Have a look at `base.yml` and adjust it to your needs -6. Start the provisioning by running `ansible-playbook -i inventory base.yml` +6. Start the provisioning by running `./run.sh` ## How does this work? -`setup.sh` will create a few folders, install Ansible and pull our generic +`run.sh` will install dependencies such as Ansible and pull our generic roles. + diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..d7f4c05 --- /dev/null +++ b/run.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +set -e + +if [ ! -d ~/.personal_provisioning/roles ]; then + echo 'Cloning roles' + git clone git@github.com:personal-provisioning/roles.git ~/.personal_provisioning/roles +else + echo "Updating roles" + CURRENT_DIR=$(pwd) + cd ~/.personal_provisioning/roles && git pull --rebase && cd $CURRENT_DIR +fi + +echo 'Installing XCode CLI Tools' +xcode-select --install || echo 'XCode CLI Tools are already installed' + +which -s brew + + +if which -s brew +then + echo 'Updating Homebrew' + brew update --all && brew upgrade && brew cleanup +else + echo 'Installing Homebrew' + ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +fi + +echo 'Installing Ansible' +brew install ansible + + +echo 'Running Ansible' + +ansible-playbook -i "localhost," -c local base.yml + diff --git a/setup.sh b/setup.sh deleted file mode 100755 index 79e7652..0000000 --- a/setup.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -set -e - -mkdir -p ~/.personal_provisioning -git clone git@github.com:personal-provisioning/roles.git ~/.personal_provisioning/roles