Inspired: PR from goettl79 - https://github.com/William-Yeh/docker-ansible/pull/1
```
FROM williamyeh/ansible:ubuntu14.04-onbuild
-# ==> Specify playbook filename; default = "playbook.yml"
-#ENV PLAYBOOK playbook.yml
+# ==> Specify requirements filename; default = "requirements.yml"
+#ENV REQUIREMENTS requirements.yml
-# ==> Specify inventory filename; default = "/etc/ansible/hosts"
-#ENV INVENTORY inventory.ini
+# ==> Specify playbook filename; default = "playbook.yml"
+#ENV PLAYBOOK playbook.yml
+
+# ==> Specify inventory filename; default = "/etc/ansible/hosts"
+#ENV INVENTORY inventory.ini
# ==> Executing Ansible...
RUN ansible-playbook-wrapper
Done!
-For more advanced usage, the role in Ansible Galaxy [`williamyeh/nginx`](https://galaxy.ansible.com/list#/roles/2245) also demonstrates how to do a simple integration test for a variety of Linux distributions on [Travis CI](https://travis-ci.org/)’s Ubuntu 12.04 worker instances.
+For more advanced usage, the role in Ansible Galaxy [`williamyeh/nginx`](https://galaxy.ansible.com/list#/roles/2245) also demonstrates how to do a simple integration test for a variety of Linux distributions on [CircleCI](https://circleci.com/)'s and [Travis CI](https://travis-ci.org/)’s Ubuntu 12.04 worker instances.
#FROM williamyeh/ansible:centos6-onbuild
-# ==> Specify playbook filename; default = "playbook.yml"
-#ENV PLAYBOOK playbook.yml
+# ==> Specify requirements filename; default = "requirements.yml"
+#ENV REQUIREMENTS requirements.yml
+
+# ==> Specify playbook filename; default = "playbook.yml"
+#ENV PLAYBOOK playbook.yml
-# ==> Specify inventory filename; default = "/etc/ansible/hosts"
-#ENV INVENTORY inventory.ini
+# ==> Specify inventory filename; default = "/etc/ansible/hosts"
+#ENV INVENTORY inventory.ini
# ==> Executing Ansible...
RUN ansible-playbook-wrapper
#!/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
#!/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
#!/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
#!/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
#!/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
#!/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