diff options
author | William Yeh <william.pjyeh@gmail.com> | 2015-06-29 08:05:38 +0800 |
---|---|---|
committer | William Yeh <william.pjyeh@gmail.com> | 2015-06-29 08:05:38 +0800 |
commit | 8287be9012178ea619ebfd35aafa1a1f9d219055 (patch) | |
tree | 25fb850bff44bd46fd79c42e36676680b6c45813 /debian8-onbuild | |
parent | ff4b9e520745ef99f4932066c5c710bc908fec4e (diff) | |
download | docker-ansible-8287be9012178ea619ebfd35aafa1a1f9d219055.tar.gz docker-ansible-8287be9012178ea619ebfd35aafa1a1f9d219055.tar.zst docker-ansible-8287be9012178ea619ebfd35aafa1a1f9d219055.zip |
Add: install Galaxy roles according to requirements.yml.
Inspired: PR from goettl79 - https://github.com/William-Yeh/docker-ansible/pull/1
Diffstat (limited to 'debian8-onbuild')
-rwxr-xr-x | debian8-onbuild/ansible-playbook-wrapper | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/debian8-onbuild/ansible-playbook-wrapper b/debian8-onbuild/ansible-playbook-wrapper index bf137c8..0ba45e6 100755 --- a/debian8-onbuild/ansible-playbook-wrapper +++ b/debian8-onbuild/ansible-playbook-wrapper | |||
@@ -1,17 +1,36 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # | 2 | # |
3 | # Simple wrapper for executing ansible-playbook with local connection. | 3 | # Simple wrapper for executing ansible-galaxy and ansible-playbook |
4 | # with local connection. | ||
4 | # | 5 | # |
5 | # USAGE: | 6 | # USAGE: |
6 | # ansible-playbook-wrapper [other ansible-playbook arguments] | 7 | # ansible-playbook-wrapper [other ansible-playbook arguments] |
7 | # | 8 | # |
8 | # ENVIRONMENT VARIABLES: | 9 | # ENVIRONMENT VARIABLES: |
9 | # | 10 | # |
10 | # - PLAYBOOK: playbook filename; default = "playbook.yml" | 11 | # - REQUIREMENTS: requirements filename; default = "requirements.yml" |
11 | # - INVENTORY: inventory filename; default = "/etc/ansible/hosts" | 12 | # - PLAYBOOK: playbook filename; default = "playbook.yml" |
12 | # | 13 | # - INVENTORY: inventory filename; default = "/etc/ansible/hosts" |
14 | # | ||
13 | 15 | ||
14 | 16 | ||
17 | # | ||
18 | # install Galaxy roles, if any | ||
19 | # | ||
20 | |||
21 | if [ -z "$REQUIREMENTS" ]; then | ||
22 | REQUIREMENTS=requirements.yml | ||
23 | fi | ||
24 | |||
25 | if [ -f "$REQUIREMENTS" ]; then | ||
26 | ansible-galaxy install -r $REQUIREMENTS | ||
27 | fi | ||
28 | |||
29 | |||
30 | # | ||
31 | # execute playbook | ||
32 | # | ||
33 | |||
15 | if [ -z "$PLAYBOOK" ]; then | 34 | if [ -z "$PLAYBOOK" ]; then |
16 | PLAYBOOK=playbook.yml | 35 | PLAYBOOK=playbook.yml |
17 | fi | 36 | fi |