Make it possible to overwrite the default evoadmin-web templates

The templates can also be forced to update if so desired.
This commit is contained in:
Patrick Marchand 2019-05-06 22:00:45 +02:00
parent 079f1e982b
commit d8385bff84
6 changed files with 81 additions and 6 deletions

View file

@ -13,6 +13,7 @@ The **patch** part changes incrementally at each release.
### Added
* apache: add server status suffix in VHost (and default site) if missing
* nginx: add server status suffix in VHost (and default site) if missing
* Overload evoadmin-web templates if needed
### Changed
* evocheck : version 19.04 from upstream

View file

@ -0,0 +1,35 @@
# Set custom web-add.conf file
- "templates/evoadmin-web/web-add.{{ inventory_hostname }}.conf.j2"
- "templates/evoadmin-web/web-add.{{ host_group }}.conf.j2"
- "templates/evoadmin-web/web-add.conf.j2"
And force it to update:
web_add_conf_force: True
# Set custom web-mail.tpl
- "templates/evoadmin-web/web-mail.{{ inventory_hostname }}.tpl.j2"
- "templates/evoadmin-web/web-mail.{{ host_group }}.tpl.j2"
- "templates/evoadmin-web/web-mail.tpl.j2"
And force it to update:
web_mail_tpl_force: True
# Set custom evoadmin.conf VHost
- "templates/evoadmin-web/evoadmin.{{ inventory_hostname }}.conf.j2"
- "templates/evoadmin-web/evoadmin.{{ host_group }}.conf.j2"
- "templates/evoadmin-web/evoadmin.conf.j2"
And force it to update:
evoadmin_web_conf_force: True
# Set custom config.local.php
- "templates/evoadmin-web/config.local.{{ inventory_hostname }}.conf.j2"
- "templates/evoadmin-web/config.local.{{ host_group }}.conf.j2"
- "templates/evoadmin-web/config.local.conf.j2"
And force it to update:
evoadmin_web_config_local_php_force: True
# Set evoadmin-web sudoers file
- "templates/evoadmin-web/sudoers.{{ inventory_hostname }}.j2"
- "templates/evoadmin-web/sudoers.{{ host_group }}.j2"
- "templates/evoadmin-web/sudoers.j2"
- "sudoers.j2"
And force it to update:
evoadmin_web_sudoers_conf_force: True

View file

@ -11,6 +11,11 @@ evoadmin_host: "evoadmin.{{ ansible_fqdn }}"
evoadmin_username: evoadmin
evoadmin_enable_vhost: True
evoadmin_force_vhost: False
evoadmin_web_config_local_php_force: False
evoadmin_web_sudoers_conf_force: False
web_add_conf_force: False
web_mail_tpl_force: False
evoadmin_tpl_servername: "{{ ansible_fqdn }}"
evoadmin_tpl_address: "{{ ansible_default_ipv4.address }}"

View file

@ -8,10 +8,24 @@
- name: Configure web-add config file
template:
src: web-add.conf.j2
src: "{{ item }}"
dest: /etc/evolinux/web-add.conf
force: "{{ web_add_conf_force | bool }}"
with_first_found:
- "templates/evoadmin-web/web-add.{{ inventory_hostname }}.conf.j2"
- "templates/evoadmin-web/web-add.{{ host_group }}.conf.j2"
- "templates/evoadmin-web/web-add.conf.j2"
- "web-add.conf.j2"
register: web_add_conf_template
- name: Configure web-add template file for mail
template:
src: web-mail.tpl.j2
src: "{{ item }}"
dest: "{{ evoadmin_scripts_dir }}/web-mail.tpl"
force: "{{ web_mail_tpl_force | bool }}"
with_first_found:
- "templates/evoadmin-web/web-mail.{{ inventory_hostname }}.tpl.j2"
- "templates/evoadmin-web/web-mail.{{ host_group }}.tpl.j2"
- "templates/evoadmin-web/web-mail.tpl.j2"
- "web-mail.default.tpl.j2"
register: web_mail_tpl_template

View file

@ -103,7 +103,14 @@
- name: Add evoadmin sudoers file
template:
src: sudoers.j2
src: "{{ item }}"
dest: /etc/sudoers.d/evoadmin
mode: "0600"
force: "{{ evoadmin_web_sudoers_conf_force | bool }}"
validate: "visudo -cf %s"
with_first_found:
- "templates/evoadmin-web/sudoers.{{ inventory_hostname }}.j2"
- "templates/evoadmin-web/sudoers.{{ host_group }}.j2"
- "templates/evoadmin-web/sudoers.j2"
- "sudoers.j2"
register: evoadmin_web_sudoers_conf

View file

@ -20,8 +20,15 @@
- name: Install evoadmin VHost
template:
src: evoadmin.conf.j2
src: "{{ item }}"
dest: /etc/apache2/sites-available/evoadmin.conf
force: "{{ evoadmin_force_vhost | bool }}"
with_first_found:
- "templates/evoadmin-web/evoadmin.{{ inventory_hostname }}.conf.j2"
- "templates/evoadmin-web/evoadmin.{{ host_group }}.conf.j2"
- "templates/evoadmin-web/evoadmin.conf.j2"
- "evoadmin.conf.j2"
register: evoadmin_vhost_template
notify: reload apache2
- name: Enable evoadmin vhost
@ -40,9 +47,15 @@
- name: Copy config file for evoadmin
template:
src: config.local.php.j2
src: "{{ item }}"
dest: "{{ evoadmin_document_root}}/conf/config.local.php"
mode: "0640"
owner: evoadmin
group: evoadmin
force: no
force: "{{ evoadmin_web_config_local_php_force | bool }}"
with_first_found:
- "templates/evoadmin-web/config.local.{{ inventory_hostname }}.conf.j2"
- "templates/evoadmin-web/config.local.{{ host_group }}.conf.j2"
- "templates/evoadmin-web/config.local.conf.j2"
- "config.local.conf.j2"
register: evoadmin_web_config_local_php_template