2019-02-28 00:20:16 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eux
|
|
|
|
|
2019-03-11 15:14:06 +01:00
|
|
|
cleanup () {
|
|
|
|
files="shostlist.txt hostlist.txt"
|
|
|
|
for file in $files; do
|
|
|
|
if [[ -f "$file" ]]; then
|
|
|
|
rm -f "$file"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2019-02-28 00:20:16 +01:00
|
|
|
for EXTRA in '{"inputlist": ["hostB", "hostA", "hostD", "hostC"]}' \
|
|
|
|
'{"myorder": "inventory", "inputlist": ["hostB", "hostA", "hostD", "hostC"]}' \
|
|
|
|
'{"myorder": "sorted", "inputlist": ["hostA", "hostB", "hostC", "hostD"]}' \
|
2019-03-11 15:14:06 +01:00
|
|
|
'{"myorder": "reverse_sorted", "inputlist": ["hostD", "hostC", "hostB", "hostA"]}' \
|
|
|
|
'{"myorder": "reverse_inventory", "inputlist": ["hostC", "hostD", "hostA", "hostB"]}' \
|
|
|
|
'{"myorder": "shuffle", "inputlist": ["hostC", "hostD", "hostA", "hostB"]}'
|
2019-02-28 00:20:16 +01:00
|
|
|
do
|
2019-03-11 15:14:06 +01:00
|
|
|
cleanup
|
2019-04-26 07:25:24 +02:00
|
|
|
ansible-playbook order.yml --forks 1 -i inventory -e "$EXTRA" "$@"
|
2019-02-28 00:20:16 +01:00
|
|
|
done
|
2019-03-11 15:14:06 +01:00
|
|
|
cleanup
|