added status page config
This commit is contained in:
parent
cb57621b33
commit
f2a2a63b66
|
|
@ -8,6 +8,12 @@ configure_security: true # https://www.digitalocean.com/community/tutorials/how
|
|||
default_apache:
|
||||
sites: {}
|
||||
|
||||
status_page:
|
||||
state: 'present'
|
||||
bind: '127.0.0.1'
|
||||
port: 80
|
||||
path: 'server-status'
|
||||
|
||||
log:
|
||||
path: '/var/log/apache2'
|
||||
per_site: true
|
||||
|
|
|
|||
|
|
@ -56,4 +56,4 @@
|
|||
owner: 'root'
|
||||
group: 'root'
|
||||
mode: 0644
|
||||
tags: [sites]
|
||||
tags: [sites, config]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
|
||||
- name: Apache | Debian | Status page | Configuring listen-port
|
||||
ansible.builtin.lineinfile:
|
||||
path: '/etc/apache2/ports.conf'
|
||||
line: "Listen {{ APACHE_CONFIG.status_page.port }}"
|
||||
ignore_errors: true
|
||||
tags: [config, sites, base]
|
||||
|
||||
- name: Apache | Debian | Status page | Configuring site
|
||||
ansible.builtin.template:
|
||||
src: 'templates/etc/apache2/sites-available/status.conf.j2'
|
||||
dest: '/etc/apache2/sites-available/status.conf'
|
||||
owner: 'root'
|
||||
group: 'root'
|
||||
mode: 0644
|
||||
tags: [config, sites, base]
|
||||
|
||||
- name: Apache | Debian | Status page | Enabling site
|
||||
ansible.builtin.file:
|
||||
state: link
|
||||
src: '/etc/apache2/sites-available/status.conf'
|
||||
dest: '/etc/apache2/sites-enabled/status.conf'
|
||||
owner: 'root'
|
||||
group: 'root'
|
||||
mode: 0644
|
||||
tags: [sites, base, config]
|
||||
|
|
@ -106,6 +106,11 @@
|
|||
- 'default-ssl.conf'
|
||||
tags: [config, base]
|
||||
|
||||
- name: Apache | Debian | Removing status page
|
||||
ansible.builtin.include_tasks: rm_status.yml
|
||||
when: APACHE_CONFIG.status_page.state != 'present'
|
||||
tags: [config, sites, base]
|
||||
|
||||
- name: Apache | Debian | Removing site
|
||||
ansible.builtin.include_tasks: rm_site.yml
|
||||
when: site.state != 'present'
|
||||
|
|
@ -125,6 +130,11 @@
|
|||
state: reloaded
|
||||
tags: [base, config, sites, certs]
|
||||
|
||||
- name: Apache | Debian | Adding status page
|
||||
ansible.builtin.include_tasks: add_status.yml
|
||||
when: APACHE_CONFIG.status_page.state == 'present'
|
||||
tags: [config, sites, base]
|
||||
|
||||
- name: Apache | Debian | Adding site
|
||||
ansible.builtin.include_tasks: add_site.yml
|
||||
when: site.state == 'present'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
|
||||
- name: Apache | Debian | Removing status page
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: absent
|
||||
loop:
|
||||
- '/etc/apache2/sites-enabled/status.conf'
|
||||
- '/etc/apache2/sites-available/status.conf'
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
# {{ ansible_managed }}
|
||||
# ansibleguy.infra_apache
|
||||
|
||||
<VirtualHost {{ APACHE_CONFIG.status_page.bind }}:{{ APACHE_CONFIG.status_page.port }}>
|
||||
# log config
|
||||
{% if APACHE_CONFIG.log.syslog and APACHE_CONFIG.log.syslog_host is not none %}
|
||||
ErrorLog "| /usr/bin/logger -n {{ APACHE_CONFIG.log.syslog_host }} -P {{ APACHE_CONFIG.log.syslog_port }} -p local1.error -t {{ APACHE_CONFIG.log.prefix_ue }}apache2_status"
|
||||
CustomLog "| /usr/bin/logger -n {{ APACHE_CONFIG.log.syslog_host }} -P {{ APACHE_CONFIG.log.syslog_port }} -p local1.info -t {{ APACHE_CONFIG.log.prefix_ue }}apache2_status" combined
|
||||
{% elif APACHE_CONFIG.log.syslog %}
|
||||
ErrorLog "| /usr/bin/logger -p local1.error -t {{ APACHE_CONFIG.log.prefix_ue }}apache2_status"
|
||||
CustomLog "| /usr/bin/logger -p local1.info -t {{ APACHE_CONFIG.log.prefix_ue }}apache2_status" combined
|
||||
{% elif APACHE_CONFIG.log.per_site %}
|
||||
ErrorLog {{ APACHE_CONFIG.log.path }}/apache2_status_error.log
|
||||
CustomLog {{ APACHE_CONFIG.log.path }}/apache2_status_access.log combined
|
||||
{% else %}
|
||||
ErrorLog {{ APACHE_CONFIG.log.path }}/error.log
|
||||
CustomLog {{ APACHE_CONFIG.log.path }}/access.log combined
|
||||
{% endif %}
|
||||
|
||||
# status page handling
|
||||
<Location "/{{ APACHE_CONFIG.status_page.path }}">
|
||||
SetHandler server-status
|
||||
</Location>
|
||||
|
||||
</VirtualHost>
|
||||
Loading…
Reference in New Issue