1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 03:32:12 +00:00
iiab/roles/awstats/tasks/install.yml

98 lines
2.9 KiB
YAML
Raw Normal View History

2017-10-27 07:55:12 +00:00
- name: Install AWStats package
package: name={{ item }}
2017-05-27 18:09:50 +00:00
state=present
with_items:
- awstats
- pwauth
- openssl
tags:
- download
2017-11-10 20:33:19 +00:00
- name: Install AWStats package (debuntu)
package: name={{ item }}
2017-05-27 18:09:50 +00:00
state=present
with_items:
- libapache2-mod-authnz-external
- apache2-utils
2017-05-27 23:10:45 +00:00
when: is_debuntu
2017-05-27 18:09:50 +00:00
tags:
- download
2017-11-10 20:33:19 +00:00
- name: enable cgi execution (debuntu)
2017-05-27 18:09:50 +00:00
command: a2enmod cgi
2017-05-27 23:10:45 +00:00
when: is_debuntu
2017-05-27 18:09:50 +00:00
2017-10-27 07:55:12 +00:00
- name: Create directory for AWStats to use as intermediate summary storage
2017-05-27 18:09:50 +00:00
file: path={{ item }}
mode=0750
owner={{ apache_user }}
group={{ apache_user }}
2017-05-27 18:09:50 +00:00
state=directory
force=true
with_items:
- "{{ awstats_data_dir }}"
- "{{ apache_log_dir }}"
2017-11-10 20:33:19 +00:00
- name: Install the Apache config for AWStats (debuntu)
2017-05-27 18:09:50 +00:00
template: src=apache.conf
dest=/etc/{{ apache_config_dir }}/awstats.conf
owner=root
group=root
mode=0644
2017-05-27 23:10:45 +00:00
when: awstats_enabled and is_debuntu
2017-05-27 18:09:50 +00:00
2017-11-10 20:33:19 +00:00
- name: Install the Apache config for AWStats (OS's other than debuntu)
2017-05-27 18:09:50 +00:00
template: src=apache-awstats.conf
dest=/etc/{{ apache_config_dir }}/awstats.conf
owner=root
group=root
mode=0644
2017-05-27 23:10:45 +00:00
when: awstats_enabled and not is_debuntu
2017-05-27 18:09:50 +00:00
2017-11-10 20:33:19 +00:00
- name: make sure logrotate does not make logs unreadable (debuntu)
2017-05-27 18:09:50 +00:00
template: src=logrotate.d.apache2
dest=/etc/logrotate.d/apache2
2017-05-27 23:10:45 +00:00
when: is_debuntu
2017-05-27 18:09:50 +00:00
- name: See if awstats package installed a config file
stat: path=/etc/awstats/awstats.conf
register: awstats
- name: If there was a config file installed by package, move it aside
command: mv /etc/awstats/awstats.conf /etc/awstats/awstats.conf.dist
when: awstats.stat.islnk is defined and not awstats.stat.islnk
2017-11-10 20:33:19 +00:00
- name: Enable AWStats (debuntu)
2017-05-27 18:09:50 +00:00
file: src=/etc/apache2/sites-available/awstats.conf
path=/etc/apache2/sites-enabled/awstats.conf
state=link
2017-05-27 23:10:45 +00:00
when: awstats_enabled and is_debuntu
2017-05-27 18:09:50 +00:00
2017-11-10 20:33:19 +00:00
- name: Disable AWStats (debuntu)
2017-05-27 18:09:50 +00:00
file: path=/etc/apache2/sites-enabled/awstats.conf
state=absent
2017-05-27 23:10:45 +00:00
when: not awstats_enabled and is_debuntu
2017-05-27 18:09:50 +00:00
2017-10-27 07:55:12 +00:00
- name: Install the AWStats config
2017-05-27 18:09:50 +00:00
template: src=awstats.schoolserver.conf.j2
dest=/etc/awstats/awstats.schoolserver.conf
owner=root
group=root
mode=0644
when: awstats_enabled
2017-10-27 07:55:12 +00:00
- name: Create a symbolic link to use when access is by IP address
2017-05-27 18:09:50 +00:00
file: src=/etc/awstats/awstats.schoolserver.conf
dest=/etc/awstats/awstats.conf
state=link
when: awstats_enabled
2017-11-10 20:33:19 +00:00
- name: On first enabling of AWStats, summarize httpd logs up to now (OS's other than debuntu)
2017-05-27 18:09:50 +00:00
shell: /bin/perl /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=schoolserver -update
2017-05-27 23:10:45 +00:00
when: awstats_enabled and not is_debuntu
2017-05-27 18:09:50 +00:00
2017-11-10 20:33:19 +00:00
- name: On first enabling of AWStats, summarize httpd logs up to now (debuntu)
2017-05-27 18:09:50 +00:00
shell: /usr/bin/perl /usr/lib/cgi-bin/awstats.pl -config=schoolserver -update
2017-05-27 23:10:45 +00:00
when: awstats_enabled and is_debuntu