From 419eb7cc59fdc9ffe75e2e66065afa5bab9ef77d Mon Sep 17 00:00:00 2001 From: binary Date: Fri, 11 Sep 2020 12:24:19 +0200 Subject: Simplify arguments --- apply_roles | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) (limited to 'apply_roles') 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 -- cgit v1.2.3