From 408c857f81a6a0a428c62d031a6ed6026cf99998 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO <ynerant@crans.org> Date: Mon, 22 Feb 2021 14:07:35 +0100 Subject: [PATCH] [zamok_apache] Pepcransification Signed-off-by: Yohann D'ANELLO <ynerant@crans.org> --- group_vars/adh_server.yml | 12 ++++++++++++ plays/zamok.yml | 2 ++ .../templates/apache2/clubs-vhosts.map.j2 | 9 +++++---- roles/zamok-tools/templates/apache2/ports.conf.j2 | 14 +++++++------- 4 files changed, 26 insertions(+), 11 deletions(-) create mode 100644 group_vars/adh_server.yml diff --git a/group_vars/adh_server.yml b/group_vars/adh_server.yml new file mode 100644 index 00000000..92670d94 --- /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 0639ad25..4c52af09 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 a3ca125d..04d15716 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 87e8178e..e5f0de31 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 -- GitLab