forked from evolix/ansible-roles
49 lines
1.4 KiB
YAML
49 lines
1.4 KiB
YAML
|
---
|
||
|
- name: Install awstats
|
||
|
apt:
|
||
|
name: awstats
|
||
|
state: present
|
||
|
|
||
|
- name: Configure awstats
|
||
|
blockinfile:
|
||
|
dest: /etc/awstats/awstats.conf.local
|
||
|
marker: "## {mark} ANSIBLE MANAGED BLOCK FOR PACKWEB"
|
||
|
block: |
|
||
|
LogFile="/var/log/apache2/access.log"
|
||
|
SiteDomain="{{ ansible_hostname }}"
|
||
|
DirData="/var/lib/awstats"
|
||
|
ShowHostsStats=0
|
||
|
ShowOriginStats=0
|
||
|
ShowPagesStats=0
|
||
|
ShowKeyphrasesStats=0
|
||
|
ShowKeywordsStats=0
|
||
|
ShowHTTPErrorsStats=0
|
||
|
LogFormat=1
|
||
|
AllowFullYearView=3
|
||
|
ErrorMessages="An error occured. Contact your Administrator"
|
||
|
mode: "0644"
|
||
|
|
||
|
- name: Create conf-available/awstats-icon.conf file
|
||
|
copy:
|
||
|
dest: /etc/apache2/conf-available/awstats-icon.conf
|
||
|
content: |
|
||
|
Alias /awstats-icon/ /usr/share/awstats/icon/
|
||
|
<Directory /usr/share/awstats/icon/>
|
||
|
Require all granted
|
||
|
</Directory>
|
||
|
force: no
|
||
|
mode: "0644"
|
||
|
|
||
|
- name: Enable apache awstats-icon configuration
|
||
|
command: "a2enconf awstats-icon"
|
||
|
register: command_result
|
||
|
changed_when: "'Enabling' in command_result.stderr"
|
||
|
notify: reload apache
|
||
|
|
||
|
- name: Create awstats cron
|
||
|
lineinfile:
|
||
|
dest: /etc/cron.d/awstats
|
||
|
create: yes
|
||
|
regexp: '-config=awstats'
|
||
|
line: "10 */6 * * * root umask 033; [ -x /usr/lib/cgi-bin/awstats.pl -a -f /etc/awstats/awstats.conf -a -r /var/log/apache2/access.log ] && /usr/lib/cgi-bin/awstats.pl -config=awstats -update >/dev/null"
|