diff --git a/apache/tasks/main.yml b/apache/tasks/main.yml index 50fb548a..dd675f4a 100644 --- a/apache/tasks/main.yml +++ b/apache/tasks/main.yml @@ -135,6 +135,20 @@ tags: - apache +- include: phpmyadmin.yml + when: _default_index.stat.exists + +- name: Check if Munin plugins exists + stat: + path: /etc/munin/plugins/ + register: _munin_plugins + check_mode: no + tags: + - apache + +- include: munin.yml + when: _munin_plugins.stat.exists + # - block: # - name: generate random string for serverstatus suffix # command: "apg -a 1 -M N -n 1" diff --git a/apache/tasks/munin.yml b/apache/tasks/munin.yml index 85f0b386..859a9ad6 100644 --- a/apache/tasks/munin.yml +++ b/apache/tasks/munin.yml @@ -21,3 +21,48 @@ tags: - apache - munin + +--- + +- name: install packages for Apache and Munin + apt: + name: "{{ item }}" + state: installed + with_items: + - libapache2-mod-fcgid + - libcgi-fast-perl + notify: reload apache + tags: + - apache + - munin + +- name: be sure to enable libapache2-mod-fcgid + command: a2enmod fcgid + register: cmd_enable_fcgid + changed_when: "'Module fcgid already enabled' not in cmd_enable_fcgid.stdout" + notify: restart apache + tags: + - apache + - munin + +- name: change group for /var/log/munin/ + file: + path: /var/log/munin/ + group: www-data + tags: + - apache + - munin + +- name: install munin plugins + file: + src: "/etc/munin/plugins/{{ item }}" + dest: "/usr/share/munin/plugins/{{ item }}" + state: link + with_items: + - apache_accesses + - apache_processes + - apache_volume + notify: restart munin-node + tags: + - apache + - munin diff --git a/apache/templates/evolinux-default.conf.j2 b/apache/templates/evolinux-default.conf.j2 index b50409a8..8c7a28af 100644 --- a/apache/templates/evolinux-default.conf.j2 +++ b/apache/templates/evolinux-default.conf.j2 @@ -19,11 +19,13 @@ Require all denied Include /etc/apache2/ipaddr_whitelist.conf - - Options -Indexes + # munin-cgi-graph, used for zooming on graphs. + ScriptAlias /munin-cgi/munin-cgi-graph /usr/lib/munin/cgi/munin-cgi-graph + + Options +ExecCGI Require all denied - Include /etc/apache2/ipaddr_whitelist.conf - + Include /etc/apache2/private_ipaddr_whitelist.conf + # For CGI Scripts. We need to set Directory directive as ScriptAlias take precedence. ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/