random suffices for phpmyadmin abnd server-status with apg

This commit is contained in:
Jérémy Lecour 2017-07-06 11:33:35 +02:00 committed by Jérémy Lecour
parent 0e0bc1cbbd
commit 34f6354a9e
4 changed files with 48 additions and 4 deletions

View File

@ -8,5 +8,5 @@ apache_private_htpasswd_absent: []
apache_default_redirect_url: "http://evolix.fr"
apache_evolinux_default_enabled: True
apache_phpmyadmin_suffix: "{{ lookup('env', 'RANDOM') }}"
apache_serverstatus_suffix: "{{ lookup('env', 'RANDOM') }}"
apache_phpmyadmin_suffix: ""
apache_serverstatus_suffix: ""

View File

@ -173,12 +173,34 @@
tags:
- apache
- block:
- name: generate random string for phpmyadmin suffix
command: "apg -a 1 -M N -n 1"
changed_when: False
register: _random_phpmyadmin_suffix
- name: overwrite apache_phpmyadmin_suffix
set_fact:
apache_phpmyadmin_suffix: "{{ _random_phpmyadmin_suffix.stdout }}"
when: apache_phpmyadmin_suffix == ""
- name: replace phpmyadmin suffix in default site index
replace:
dest: /var/www/index.html
regexp: '__PHPMYADMIN_SUFFIX__'
replace: "{{ apache_phpmyadmin_suffix }}"
- block:
- name: generate random string for serverstatus suffix
command: "apg -a 1 -M N -n 1"
changed_when: False
register: _random_serverstatus_suffix
- name: overwrite apache_serverstatus_suffix
set_fact:
apache_serverstatus_suffix: "{{ _random_serverstatus_suffix.stdout }}"
when: apache_serverstatus_suffix == ""
- name: replace server-status suffix in default site index
replace:
dest: /var/www/index.html

View File

@ -8,5 +8,5 @@ nginx_private_htpasswd_absent: []
nginx_default_redirect_url: "http://evolix.fr"
nginx_evolinux_default_enabled: True
# nginx_phpmyadmin_suffix: "{{ lookup('env', 'RANDOM') }}"
# nginx_serverstatus_suffix: "{{ lookup('env', 'RANDOM') }}"
# nginx_phpmyadmin_suffix: ""
# nginx_serverstatus_suffix: ""

View File

@ -129,12 +129,34 @@
tags:
- nginx
# - block:
# - name: generate random string for phpmyadmin suffix
# command: "apg -a 1 -M N -n 1"
# changed_when: False
# register: random_phpmyadmin_suffix
#
# - name: overwrite nginx_phpmyadmin_suffix
# set_fact:
# nginx_phpmyadmin_suffix: "{{ random_phpmyadmin_suffix.stdout }}"
# when: nginx_phpmyadmin_suffix == ""
#
# - name: replace phpmyadmin suffix in default site index
# replace:
# dest: /var/www/index.html
# regexp: '__PHPMYADMIN_SUFFIX__'
# replace: "{{ nginx_phpmyadmin_suffix }}"
#
# - block:
# - name: generate random string for serverstatus suffix
# command: "apg -a 1 -M N -n 1"
# changed_when: False
# register: random_serverstatus_suffix
#
# - name: overwrite nginx_serverstatus_suffix
# set_fact:
# nginx_serverstatus_suffix: "{{ random_phpmyadmin_suffix.stdout }}"
# when: nginx_serverstatus_suffix == ""
#
# - name: replace server-status suffix in default site index
# replace:
# dest: /var/www/index.html