From: Oleg Broytman Date: Tue, 9 Jun 2026 13:43:15 +0000 (+0300) Subject: Feat(playbooks/debian/add-apache-vhosts): Add many vhosts X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=272b844f4db49cd8c7db7d4146930a38115e8a96;p=ansible.git Feat(playbooks/debian/add-apache-vhosts): Add many vhosts Add multiple virtual hosts instead of just one. --- diff --git a/playbooks/debian/add-apache-vhost b/playbooks/debian/add-apache-vhost deleted file mode 100755 index 4139eb4..0000000 --- a/playbooks/debian/add-apache-vhost +++ /dev/null @@ -1,15 +0,0 @@ -#! /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" diff --git a/playbooks/debian/add-apache-vhosts b/playbooks/debian/add-apache-vhosts new file mode 100755 index 0000000..25cf241 --- /dev/null +++ b/playbooks/debian/add-apache-vhosts @@ -0,0 +1,15 @@ +#! /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} diff --git a/playbooks/debian/add-apache-vhosts.yaml b/playbooks/debian/add-apache-vhosts.yaml new file mode 100644 index 0000000..332282f --- /dev/null +++ b/playbooks/debian/add-apache-vhosts.yaml @@ -0,0 +1,9 @@ +- 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 }} diff --git a/playbooks/debian/roles b/playbooks/debian/roles new file mode 120000 index 0000000..d8c4472 --- /dev/null +++ b/playbooks/debian/roles @@ -0,0 +1 @@ +../roles \ No newline at end of file