diff --git a/group_vars/adh_server.yml b/group_vars/adh_server.yml new file mode 100644 index 0000000000000000000000000000000000000000..92670d943fb51340df9a7ef069bd5af5243f5346 --- /dev/null +++ b/group_vars/adh_server.yml @@ -0,0 +1,12 @@ +--- +glob_adh: + apache: + listen_local: + - "127.0.0.1:80" + - "[::1]:80" + listen_network: "{{ query('ldap', 'ip', ansible_hostname, 'adm') | ipwrap }}" + club_vhosts: + - from: pot-vieux.crans.org + to: club-vieux/www + - from: med.crans.org + to: club-med/www diff --git a/plays/zamok.yml b/plays/zamok.yml index 0639ad25878ad5815cc08d679ada170080383ae2..4c52af0948e64886c7b74a162515b223bada1faa 100755 --- a/plays/zamok.yml +++ b/plays/zamok.yml @@ -2,6 +2,8 @@ --- - hosts: adh_server + vars: + adh: '{{ glob_adh | combine(loc_adh | default({}), recursive=True) }}' roles: - zamok-tools - postfix diff --git a/roles/zamok-tools/templates/apache2/clubs-vhosts.map.j2 b/roles/zamok-tools/templates/apache2/clubs-vhosts.map.j2 index a3ca125d35541ded5a56cb12c2a43e897a2a4830..04d15716a24e9feee157cdca0317b283247729f9 100644 --- a/roles/zamok-tools/templates/apache2/clubs-vhosts.map.j2 +++ b/roles/zamok-tools/templates/apache2/clubs-vhosts.map.j2 @@ -1,4 +1,5 @@ -pot-vieux.crans.org club-vieux/www -med.crans.org club-med/www -www.scepinvaders.com waltsburger/www -scepinvaders.com waltsburger/www +{{ ansible_header | comment }} + +{% for host in adh.apache.club_vhosts -%} +{{ host.from }} {{ host.to }} +{% endfor -%} diff --git a/roles/zamok-tools/templates/apache2/ports.conf.j2 b/roles/zamok-tools/templates/apache2/ports.conf.j2 index 87e8178e9a97c0fb95d411d2dfce917989e4776e..e5f0de3174aadcd2ab5887ec54be1835aba28816 100644 --- a/roles/zamok-tools/templates/apache2/ports.conf.j2 +++ b/roles/zamok-tools/templates/apache2/ports.conf.j2 @@ -1,9 +1,9 @@ -# If you just change the port or add more ports here, you will likely also -# have to change the VirtualHost statement in -# /etc/apache2/sites-enabled/000-default.conf +{{ ansible_header | comment }} -Listen 127.0.0.1:80 -Listen 172.16.10.31:80 -Listen [::1]:80 -Listen [fd00::10:1e98:ecff:fe15:2c8a]:80 +{% for host in adh.apache.listen_local -%} +Listen {{ host }} +{% endfor -%} +{% for host in adh.apache.listen_network -%} +Listen {{ host }}:80 +{% endfor -%} # vim: syntax=apache ts=4 sw=4 sts=4 sr noet