indent_size = 2
[all.ShellCheck]
-bears = ShellCheckBear,SpaceConsistencyBear
-files = provision/**.sh
+bears = ShellCheckBear, SpaceConsistencyBear, LineLengthBear
+files = provision/**.sh, ansible-galaxy.sh
shell = bash
indent_size = 4
-use_spaces = yeah
+use_spaces = True
+max_line_length = 80
[YAML]
bears = YAMLLintBear
# http://www.eclipse.org/legal/epl-v10.html
##############################################################################
-ANSIBLE_ROLES_PATH="${1:-.galaxy}"
-ANSIBLE_REQUIREMENTS_FILE="${2:-requirements.yaml}"
-SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+set -eu -o pipefail -o noglob
-set -eux -o pipefail
+echo "----> ansible-galaxy.sh"
-ansible-galaxy install -p "$ANSIBLE_ROLES_PATH" -r "$SCRIPT_DIR/requirements.yaml"
+ansible_roles_path=${1:-.galaxy}
+ansible_requirements_file=${2:-requirements.yaml}
+script_dir=$(dirname "$0")
-if [ -f "$ANSIBLE_REQUIREMENTS_FILE" ]; then
- ansible-galaxy install -p "$ANSIBLE_ROLES_PATH" -r "$ANSIBLE_REQUIREMENTS_FILE"
+cmd="ansible-galaxy install -p $ansible_roles_path -r \
+ $script_dir/requirements.yaml"
+echo "Running: $cmd"
+$cmd
+
+# Check for local requirements file
+if [[ -f $ansible_requirements_file ]]; then
+ cmd="ansible-galaxy install -p $ansible_roles_path -r \
+ $ansible_requirements_file"
+ echo "Running: $cmd"
+ $cmd
fi
##############################################################################
# vi: ts=4 sw=4 sts=4 et :
+set -eu -o pipefail -o noglob
+
+echo "----> install-python.sh"
+
# Ansible requires Python 2 so check availability and install as necessary.
-if ! command -v /usr/bin/python; then
- # Ubuntu 16.04 does not come with Python 2 by default.
- if command -v apt; then
- apt -y update
- apt install -y python-minimal
+# Ubuntu 16.04 does not come with Python 2 by default
+
+function is_ubuntu()
+{
+ # If the file exist and contains ubuntu entry return 0
+ if egrep -q "^ID=ubuntu" /etc/os-release 2> /dev/null; then
+ echo "Distro is Ubuntu"
+ return 0
fi
+ echo "Distro is NOT Ubuntu"
+ return 1
+}
+
+if is_ubuntu; then
+ echo "Installing python-minimal..."
+ apt -y update
+ apt install -y python-minimal
fi
+
+type python
+type sudo