From 8287be9012178ea619ebfd35aafa1a1f9d219055 Mon Sep 17 00:00:00 2001 From: William Yeh Date: Mon, 29 Jun 2015 08:05:38 +0800 Subject: Add: install Galaxy roles according to requirements.yml. Inspired: PR from goettl79 - https://github.com/William-Yeh/docker-ansible/pull/1 --- ubuntu14.04-onbuild/ansible-playbook-wrapper | 29 +++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'ubuntu14.04-onbuild') diff --git a/ubuntu14.04-onbuild/ansible-playbook-wrapper b/ubuntu14.04-onbuild/ansible-playbook-wrapper index bf137c8..0ba45e6 100755 --- a/ubuntu14.04-onbuild/ansible-playbook-wrapper +++ b/ubuntu14.04-onbuild/ansible-playbook-wrapper @@ -1,17 +1,36 @@ #!/bin/sh # -# Simple wrapper for executing ansible-playbook with local connection. +# Simple wrapper for executing ansible-galaxy and ansible-playbook +# with local connection. # # USAGE: # ansible-playbook-wrapper [other ansible-playbook arguments] # # ENVIRONMENT VARIABLES: -# -# - PLAYBOOK: playbook filename; default = "playbook.yml" -# - INVENTORY: inventory filename; default = "/etc/ansible/hosts" -# +# +# - REQUIREMENTS: requirements filename; default = "requirements.yml" +# - PLAYBOOK: playbook filename; default = "playbook.yml" +# - INVENTORY: inventory filename; default = "/etc/ansible/hosts" +# +# +# install Galaxy roles, if any +# + +if [ -z "$REQUIREMENTS" ]; then + REQUIREMENTS=requirements.yml +fi + +if [ -f "$REQUIREMENTS" ]; then + ansible-galaxy install -r $REQUIREMENTS +fi + + +# +# execute playbook +# + if [ -z "$PLAYBOOK" ]; then PLAYBOOK=playbook.yml fi -- cgit v1.2.3