mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 03:32:12 +00:00
84 lines
2.9 KiB
YAML
84 lines
2.9 KiB
YAML
- name: 'Install 3 packages: awstats, openssl, pwauth'
|
|
package:
|
|
name:
|
|
- awstats
|
|
- pwauth
|
|
- openssl
|
|
state: present
|
|
|
|
- name: 'Install 2 packages: apache2-utils, libapache2-mod-authnz-external'
|
|
package:
|
|
name:
|
|
- libapache2-mod-authnz-external
|
|
- apache2-utils
|
|
state: present
|
|
|
|
- name: Enable cgi execution via Apache
|
|
command: a2enmod cgi
|
|
|
|
- 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 }}"
|
|
owner: "{{ apache_user }}"
|
|
group: "{{ apache_user }}"
|
|
mode: '0750'
|
|
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 /etc/{{ apache_config_dir }}/awstats.conf from template
|
|
template:
|
|
src: apache-awstats.conf
|
|
dest: "/etc/{{ apache_config_dir }}/awstats.conf"
|
|
|
|
- name: Install /etc/logrotate.d/apache2 from template, to ensure logrotate doesn't make logs unreadable
|
|
template:
|
|
src: logrotate.d.apache2
|
|
dest: /etc/logrotate.d/apache2
|
|
|
|
- name: Does /etc/awstats/awstats.conf exist?
|
|
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: Symlink /usr/lib/cgi-bin/awstats/awstats.pl -> /usr/lib/cgi-bin/awstats.pl so 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 from template
|
|
template:
|
|
src: awstats.schoolserver.conf.j2
|
|
dest: /etc/awstats/awstats.schoolserver.conf
|
|
# when: awstats_enabled | bool
|
|
|
|
- name: Symlink /etc/awstats/awstats.conf -> /etc/awstats/awstats.schoolserver.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
|
|
shell: /usr/bin/perl /usr/lib/cgi-bin/awstats.pl -config=schoolserver -update
|
|
# when: awstats_enabled | bool
|
|
|
|
- name: "Add 'awstats_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
|
|
lineinfile:
|
|
dest: "{{ iiab_state_file }}"
|
|
regexp: '^awstats_installed'
|
|
line: 'awstats_installed: True'
|
|
state: present
|