Skip to content

Commit

Permalink
feat(provision): add env var config to bootstrap
Browse files Browse the repository at this point in the history
Adds a set of environment variables one can set before running the
bootstrap script in order to modify its behaviour.
  • Loading branch information
eliasnorrby committed Apr 16, 2020
1 parent 60de319 commit f49e63f
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,44 @@
# This script is intended to be run with curl, i.e.
#
# bash <(curl -s https://raw.githubusercontent.com/eliasnorrby/dotfiles/develop/bootstrap.sh)
#
#
# # Configuration
# There are a number of environment variables you can set prior to
# running this script in order to customize its behaviour.
#
# DOTFILES_VERSION: (master|develop|...)
# Select which branch to download a snapshot of
# DO_MAS: (true)
# Enable to install Mac App Store apps. Make sure you log into the
# App Store app with your Apple ID first.
# ASK_PASS: (true)
# Add the -K (--ask-become-pass) flag to ansible-playbook. This may
# or may not be needed to properly install homebrew.
#
# # Extended example:
#
# DO_MAS=true ASK_PASS=true bash <(curl -s https://raw.githubusercontent.com/eliasnorrby/dotfiles/develop/bootstrap.sh)
#

SECONDS=0

if [ -z "$DOTFILES_VERSION" ] ; then
DOTFILES_VERSION=${1:-master}
fi

ANSIBLE_TAGS='all,setup_homebrew,do_homebrew,do_packages,do_defaults,do_post_provision'
ANSIBLE_FLAGS=''

if [ "$DO_MAS" == true ]; then
ANSIBLE_TAGS="${ANSIBLE_TAGS},do_mas"
fi

if [ "$ASK_PASS" == true ]; then
# Ask for sudo password (possibly required for homebrew role)
ANSIBLE_FLAGS="-K"
fi

set -exo pipefail

export DOTFILES_REPO="https://github.com/eliasnorrby/dotfiles"
Expand Down Expand Up @@ -38,7 +69,7 @@ cd _provision
ansible-galaxy install -r requirements.yml

_msg "Running the playbook..."
ansible-playbook playbook.yml --tags 'all,setup_homebrew,do_homebrew,do_packages,do_defaults,do_post_provision' -v
ansible-playbook playbook.yml --tags "$ANSIBLE_TAGS" "$ANSIBLE_FLAGS" -v

_msg "Run post-install script..."
cd $DOTFILES
Expand Down

0 comments on commit f49e63f

Please sign in to comment.