Skip to content

extending provision.sh to support tags in plays #2431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions scripts/_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ LINT="no"
ABSOLUTE_PLAYBOOK_PATH="no"
PARALLEL_RUN="no"
BOTO_PROFILE=""
TAGS=""
# Ensure build workspace exists.
if [ ! -d "$BUILD_WORKSPACE_BASE" ]; then
mkdir "$BUILD_WORKSPACE_BASE"
Expand Down Expand Up @@ -80,6 +81,10 @@ parse_options(){
"--list-tasks")
LIST_TASKS="yes"
;;
"--tags")
shift
TAGS="$1"
;;
"--verbose")
VERBOSE="yes"
;;
Expand Down Expand Up @@ -196,6 +201,9 @@ ansible_play(){
if [ "$LIST_TASKS" = "yes" ]; then
ANSIBLE_CMD="$ANSIBLE_CMD --list-tasks"
fi
if [ -n "$TAGS" ]; then
ANSIBLE_CMD="$ANSIBLE_CMD --tags $TAGS"
fi
if [ "$VERBOSE" = "yes" ]; then
ANSIBLE_CMD="$ANSIBLE_CMD -vvvv"
fi
Expand Down
1 change: 1 addition & 0 deletions scripts/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ usage(){
echo '--boto-profile: Name of a profile to export as AWS_PROFILE before calling Ansible.'
echo '--parallel: Run all playbooks in the --playbook directory in parallel (using ansible-parallel).'
echo '--lint: Run ansible-lint against the playbooks instead of executing them.'
echo '--tags: Only tagged parts of the playbooks. Can be used in combo with --list tasks'
}

# Common processing.
Expand Down
Loading