]> git.immae.eu Git - github/fretlink/docker-ansible.git/commitdiff
Add: install Galaxy roles according to requirements.yml.
authorWilliam Yeh <william.pjyeh@gmail.com>
Mon, 29 Jun 2015 00:05:38 +0000 (08:05 +0800)
committerWilliam Yeh <william.pjyeh@gmail.com>
Mon, 29 Jun 2015 00:05:38 +0000 (08:05 +0800)
Inspired: PR from goettl79 - https://github.com/William-Yeh/docker-ansible/pull/1

README.md
centos6-onbuild/ansible-playbook-wrapper
centos7-onbuild/ansible-playbook-wrapper
debian7-onbuild/ansible-playbook-wrapper
debian8-onbuild/ansible-playbook-wrapper
ubuntu12.04-onbuild/ansible-playbook-wrapper
ubuntu14.04-onbuild/ansible-playbook-wrapper

index b41d1d2ffe30354ff66c7a4db727e6b1c5ef6976..8fd53bb815dfd8b96400f7f7fcfa01416be10691 100644 (file)
--- a/README.md
+++ b/README.md
@@ -53,11 +53,14 @@ Second, put the following `Dockerfile` along with your playbook directory:
 ```
 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
@@ -67,7 +70,7 @@ Third, `docker build .`
 
 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.
 
 
 
@@ -173,11 +176,14 @@ FROM williamyeh/ansible:ubuntu14.04-onbuild
 #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
index bf137c814c69ac515e0f111688fd50b8a204e08d..0ba45e6d33a5c8ac18d815a70807b630ece38444 100755 (executable)
@@ -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
index bf137c814c69ac515e0f111688fd50b8a204e08d..0ba45e6d33a5c8ac18d815a70807b630ece38444 100755 (executable)
@@ -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
index bf137c814c69ac515e0f111688fd50b8a204e08d..0ba45e6d33a5c8ac18d815a70807b630ece38444 100755 (executable)
@@ -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
index bf137c814c69ac515e0f111688fd50b8a204e08d..0ba45e6d33a5c8ac18d815a70807b630ece38444 100755 (executable)
@@ -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
index bf137c814c69ac515e0f111688fd50b8a204e08d..0ba45e6d33a5c8ac18d815a70807b630ece38444 100755 (executable)
@@ -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
index bf137c814c69ac515e0f111688fd50b8a204e08d..0ba45e6d33a5c8ac18d815a70807b630ece38444 100755 (executable)
@@ -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