diff options
author | binary <me@rgoncalves.se> | 2020-09-11 12:24:19 +0200 |
---|---|---|
committer | binary <me@rgoncalves.se> | 2020-09-11 12:24:19 +0200 |
commit | 419eb7cc59fdc9ffe75e2e66065afa5bab9ef77d (patch) | |
tree | 71a35796d01e768bed59084d4e7970870fe19f5a | |
parent | 233ad559b499c8441fd230d76afa8f4082099fac (diff) | |
download | infrastructure-419eb7cc59fdc9ffe75e2e66065afa5bab9ef77d.tar.gz |
Simplify arguments
-rwxr-xr-x | apply_roles | 31 |
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 |