mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 11:42:08 +00:00
100 lines
3.1 KiB
YAML
100 lines
3.1 KiB
YAML
- name: 'Install 3 packages: awstats, openssl, pwauth'
|
|
package:
|
|
name:
|
|
- awstats
|
|
- pwauth
|
|
- openssl
|
|
state: present
|
|
tags:
|
|
- download
|
|
|
|
- name: 'Install 2 packages: apache2-utils, libapache2-mod-authnz-external (debuntu)'
|
|
package:
|
|
name:
|
|
- libapache2-mod-authnz-external
|
|
- apache2-utils
|
|
state: present
|
|
when: is_debuntu | bool
|
|
tags:
|
|
- download
|
|
|
|
- name: Enable cgi execution (debuntu)
|
|
command: a2enmod cgi
|
|
when: is_debuntu | bool
|
|
|
|
- name: 'Mandate {{ apache_user }}:{{ apache_user }} perm 0750 dirs: {{ awstats_data_dir }} (intermediate summary storage) & {{ apache_log_dir }}' # /library/awstats & /var/log/apache2 typically
|
|
file:
|
|
path: "{{ item }}"
|
|
mode: 0750
|
|
owner: "{{ apache_user }}"
|
|
group: "{{ apache_user }}"
|
|
state: directory
|
|
recurse: yes
|
|
force: yes
|
|
with_items:
|
|
- "{{ awstats_data_dir }}"
|
|
- "{{ apache_log_dir }}"
|
|
- /usr/lib/cgi-bin/awstats # create backward compatible path for awstats
|
|
|
|
- name: Install Apache's awstats.conf from template (debuntu)
|
|
template:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
with_items:
|
|
- { src: "apache-awstats.conf", dest: "/etc/{{ apache_config_dir }}/awstats.conf" }
|
|
when: awstats_enabled and is_debuntu
|
|
|
|
- name: Ensure logrotate doesn't make logs unreadable (debuntu)
|
|
template:
|
|
src: logrotate.d.apache2
|
|
dest: /etc/logrotate.d/apache2
|
|
when: is_debuntu | bool
|
|
|
|
- name: Check if package installed /etc/awstats/awstats.conf
|
|
stat:
|
|
path: /etc/awstats/awstats.conf
|
|
register: awstats
|
|
|
|
- name: If so, move it aside to /etc/awstats/awstats.conf.dist
|
|
command: mv /etc/awstats/awstats.conf /etc/awstats/awstats.conf.dist
|
|
when: awstats.stat.islnk is defined and not awstats.stat.islnk
|
|
|
|
- name: Create symlink for awstats.pl from cgi-bin/awstats/awstats.pl to ../ so that the old apache links to awstats will work after change to nginx
|
|
file:
|
|
src: /usr/lib/cgi-bin/awstats.pl
|
|
path: /usr/lib/cgi-bin/awstats/awstats.pl
|
|
state: link
|
|
|
|
- name: Install /etc/awstats/awstats.schoolserver.conf
|
|
template:
|
|
src: awstats.schoolserver.conf.j2
|
|
dest: /etc/awstats/awstats.schoolserver.conf
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
when: awstats_enabled | bool
|
|
|
|
- name: Create a symlink /etc/awstats/awstats.conf for access by IP address
|
|
file:
|
|
src: /etc/awstats/awstats.schoolserver.conf
|
|
path: /etc/awstats/awstats.conf
|
|
state: link
|
|
when: awstats_enabled | bool
|
|
|
|
- name: On first enabling of AWStats, summarize httpd logs up to now (OS's other than debuntu)
|
|
shell: /bin/perl /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=schoolserver -update
|
|
when: awstats_enabled and not is_debuntu
|
|
|
|
- name: On first enabling of AWStats, summarize httpd logs up to now (debuntu)
|
|
shell: /usr/bin/perl /usr/lib/cgi-bin/awstats.pl -config=schoolserver -update
|
|
when: awstats_enabled and is_debuntu
|
|
|
|
- name: Add 'awstats_installed' variable values to {{ iiab_state_file }}
|
|
lineinfile:
|
|
dest: "{{ iiab_state_file }}"
|
|
regexp: '^awstats_installed'
|
|
line: 'awstats_installed: True'
|
|
state: present
|