-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathansible-docker.sh
More file actions
executable file
·42 lines (36 loc) · 897 Bytes
/
ansible-docker.sh
File metadata and controls
executable file
·42 lines (36 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
SHARED=$(pwd)/src/:/app/
ARG0=$2
function bake(){
docker build -t diegopacheco/ansibledocker . --network=host
}
function run(){
docker run -v $SHARED --rm --name ansibledocker diegopacheco/ansibledocker
}
function lint(){
if [[ "$ARG0" = *[!\ ]* ]];
then
docker run -v $SHARED --rm -ti diegopacheco/ansibledocker /bin/sh -c "ansible-lint /app/$ARG0"
else
echo "Missing lint file! Valid sample: ./ansible-docker.sh lint main.yml"
fi
}
function help(){
echo "Ansible-Docker: by Diego Pacheco"
echo "bake : bake the docker image"
echo "run : run whats inside src/main.yml with ansible-playbook"
echo "lint : run ansible-lint in a specific file. .ie: ./ansible-docker.sh lint main.yml"
}
case $1 in
"bake")
bake
;;
"run")
run
;;
"lint")
lint
;;
*)
help
esac