diff --git a/roles/webserver/tasks/configure_apache_snmpd.yml b/roles/webserver/tasks/configure_apache_snmpd.yml new file mode 100644 index 0000000..54e3752 --- /dev/null +++ b/roles/webserver/tasks/configure_apache_snmpd.yml @@ -0,0 +1,26 @@ +- name: webserver | snmpd | create cache directory + file: + path: "/var/cache/librenms/" + state: directory + owner: "{{ snmp-user | default('root)'' }}" + +- name: webserver | snmpd | install requirement + package: + name: "python3-urllib3" + state: latest + +- name: webserver | snmpd | get script + get_url: + url: "https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/apache-stats.py" + dest: "/etc/snmp/apache-stats.py" + mode: "0755" + owner: "root" + group: "root" + +- name: webserver | snmpd | configure extend + lineinfile: + path: "{{ snmpd_conf }}" + state: present + line: "extend apache /etc/snmp/apache-stats.py" + insertafter: "# SECTION: custom settings" + notify: restart_snmpd \ No newline at end of file diff --git a/roles/webserver/tasks/install_apache.yml b/roles/webserver/tasks/install_apache.yml index 94e97a9..ba7bdfd 100644 --- a/roles/webserver/tasks/install_apache.yml +++ b/roles/webserver/tasks/install_apache.yml @@ -3,16 +3,10 @@ name: "{{ apache_package }}" state: latest -# - name: webserver | apache | setup localhost for statistics -# copy: -# src: "apache_localhost" -# dest: "/etc/apache/sites-available/localhost" +- name: webserver | apache | setup server-statistics + command: + free_form: # not required. The command module takes a free form command to run. There is no actual parameter named 'free form'. + cmd: 'a2enmod status' + creates: '/etc/apache2/mods-enabled/status.conf' -# - name: webserver | apache | link sites-available to sites-enabled for localhost -# file: -# path: "/etc/apache/sites-enabled/localhost" -# state: link -# src: "/etc/apache/sites-available/localhost" -# notify: restart_apache - -# - include_tasks: configure_apache_snmpd.yml \ No newline at end of file +- include_tasks: configure_apache_snmpd.yml