aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2020-09-11 12:24:19 +0200
committerbinary <me@rgoncalves.se>2020-09-11 12:24:19 +0200
commit419eb7cc59fdc9ffe75e2e66065afa5bab9ef77d (patch)
tree71a35796d01e768bed59084d4e7970870fe19f5a
parent233ad559b499c8441fd230d76afa8f4082099fac (diff)
downloadinfrastructure-419eb7cc59fdc9ffe75e2e66065afa5bab9ef77d.tar.gz
Simplify arguments
-rwxr-xr-xapply_roles31
1 files changed, 4 insertions, 27 deletions
diff --git a/apply_roles b/apply_roles
index 1551cc7..ad33233 100755
--- a/apply_roles
+++ b/apply_roles
@@ -5,33 +5,10 @@
# @usage
# Help fonction
function usage() {
- echo "Usage: ${0}
- -p : playbook file
- -r : roles to be applied
- -l : limit application to specific machines
- -h : show this help, then exit
- "
+ echo "Usage: ${0} \"role1 role2 .. roleN\" [ANSIBLE_ARGUMENTS]"
}
-while getopts "hp:r:l:" c; do
- case ${c} in
- p)
- playbook="${OPTARG}"
- ;;
- r)
- role="${OPTARG}"
- ;;
- l)
- limit="${OPTARG}"
- ;;
- h)
- usage;
- exit 0;
- esac
-done
-
-echo ${role}
-
-for current_role in ${role[@]}; do
- ansible-playbook "${playbook}" --tags "${current_role}" -l "${limit}"
+for role in ${1}; do
+ ansible_args=$(echo "${@:2}")
+ ansible-playbook ${ansible_args} --tags "${role}"
done
remember that computers suck.