1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Clean awstats/tasks/install.yml

This commit is contained in:
A Holt 2020-01-11 17:56:09 -05:00 committed by GitHub
parent 702bf30a02
commit b8f029d24a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,29 +5,23 @@
- pwauth
- openssl
state: present
tags:
- download
- name: 'Install 2 packages: apache2-utils, libapache2-mod-authnz-external (debuntu)'
- name: 'Install 2 packages: apache2-utils, libapache2-mod-authnz-external'
package:
name:
- libapache2-mod-authnz-external
- apache2-utils
state: present
when: is_debuntu | bool
tags:
- download
- name: Enable cgi execution (debuntu)
- name: Enable cgi execution via Apache
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 }}"
mode: '0750'
state: directory
recurse: yes
force: yes
@ -36,24 +30,17 @@
- "{{ apache_log_dir }}"
- /usr/lib/cgi-bin/awstats # create backward compatible path for awstats
- name: Install Apache's awstats.conf from template (debuntu)
- name: Install /etc/{{ apache_config_dir }}/awstats.conf from template
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
src: apache-awstats.conf
dest: "/etc/{{ apache_config_dir }}/awstats.conf"
- name: Ensure logrotate doesn't make logs unreadable (debuntu)
- 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
when: is_debuntu | bool
- name: Check if package installed /etc/awstats/awstats.conf
- name: Does /etc/awstats/awstats.conf exist?
stat:
path: /etc/awstats/awstats.conf
register: awstats
@ -62,37 +49,34 @@
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
- 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
- name: Install /etc/awstats/awstats.schoolserver.conf from template
template:
src: awstats.schoolserver.conf.j2
dest: /etc/awstats/awstats.schoolserver.conf
owner: root
group: root
mode: 0644
when: awstats_enabled | bool
# when: awstats_enabled | bool
- name: Create a symlink /etc/awstats/awstats.conf for access by IP address
- 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
# 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 (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)
- 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 and is_debuntu
# when: awstats_enabled | bool
- name: Add 'awstats_installed' variable values to {{ iiab_state_file }}
- name: Add 'awstats_installed: True' to {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
lineinfile:
dest: "{{ iiab_state_file }}"
regexp: '^awstats_installed'