aboutsummaryrefslogtreecommitdiffstats
path: root/apply_roles
blob: 1551cc782bcf45481f8fa62015e53897da7dc60e (plain) (blame)
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
#!/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
remember that computers suck.