Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sol1 Ansible Roles
sol1-influxdb
Commits
c4944872
Commit
c4944872
authored
May 27, 2016
by
Ross McDonald
Browse files
Add convenience wrapper for running playbooks in docker.
parent
2c320f54
Changes
1
Hide whitespace changes
Inline
Side-by-side
run-playbook-in-docker.sh
0 → 100755
View file @
c4944872
#!/bin/bash
function
err
{
echo
"ERROR:
$@
"
exit
1
}
current_directory
=
"
$(
pwd
)
"
# Check for Docker
which docker &>/dev/null
||
err
"Docker is required to run Ansible playbooks."
# Validate the Docker image is available (assuming images are named)
docker_image
=
"
$1
"
docker images |
awk
"{ print
\$
1
\"
:
\"
\$
2 }"
|
grep
"
$1
"
&>/dev/null
||
err
"Could not find Docker image:
$docker_image
"
# Create symlinks to previous directory (assumes the influxdb module is in a module directory)
# module_dirs="$(ls -1 ../)"
# echo "Creating symlinks for each folder in '$(dirname $current_directory)' so that Ansible can find them..."
# for dir in ${module_dirs[@]}; do
# test -h ./$dir && err "Stopping due to current directory containing symlink $dir"
# test -d ./$dir && err "Stopping due to current directory containing dir $dir"
# ln -s ../$dir $dir
# done
echo
"Running in Docker:
$@
"
docker run
\
--rm
\
-v
$(
pwd
)
:/root
\
$@
# Remove symlinks so that current directory is clean
# echo "Clearing symlinks..."
# for dir in ${module_dirs[@]}; do rm $dir; done
exit
0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment