diff options
Diffstat (limited to 'apply_roles')
-rwxr-xr-x | apply_roles | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/apply_roles b/apply_roles new file mode 100755 index 0000000..1551cc7 --- /dev/null +++ b/apply_roles @@ -0,0 +1,37 @@ +#!/bin/bash +# +# Apply specific ansible tags/roles to selected machine + +# @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 + " +} + +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}" +done |