Add multiple virtual hosts instead of just one.
+++ /dev/null
-#! /bin/sh
-
-if [ -z "$2" ]; then
- echo "Usage: $0 host vhost [...params...]" >&2
- exit 1
-fi
-
-host="$1"
-shift
-vhost="$1"
-shift
-
-cd "`dirname \"$0\"`" &&
-exec ../run-roles debian/add-apache-vhost "$@" \
- -e virtual_host="$vhost" -e gather_facts=true -e hosts="$host"
--- /dev/null
+#! /bin/sh
+
+if [ -z "$2" ]; then
+ echo "Usage: $0 host vhost1[,vhost2,...] [...params...]" >&2
+ exit 1
+fi
+
+host="$1"
+shift
+vhosts="$1"
+shift
+
+cd "`dirname \"$0\"`" &&
+exec ansible-playbook add-apache-vhosts.yaml "$@" \
+ -e vhosts="$vhosts" -e hosts="$host" 2>&1 | ${PAGER:-more}
--- /dev/null
+- name: "Add apache vhosts {{ vhosts }}"
+ hosts: "{{ hosts }}"
+ gather_facts: true
+ tasks:
+ - include_role:
+ name: debian/add-apache-vhost
+ loop: "{{ vhosts.split(',') }}"
+ loop_control:
+ loop_var: virtual_host # to avoid collision with {{ item }}
--- /dev/null
+../roles
\ No newline at end of file