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,55 +5,42 @@
- pwauth - pwauth
- openssl - openssl
state: present 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: package:
name: name:
- libapache2-mod-authnz-external - libapache2-mod-authnz-external
- apache2-utils - apache2-utils
state: present state: present
when: is_debuntu | bool
tags:
- download
- name: Enable cgi execution (debuntu) - name: Enable cgi execution via Apache
command: a2enmod cgi 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 - 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: file:
path: "{{ item }}" path: "{{ item }}"
mode: 0750
owner: "{{ apache_user }}" owner: "{{ apache_user }}"
group: "{{ apache_user }}" group: "{{ apache_user }}"
mode: '0750'
state: directory state: directory
recurse: yes recurse: yes
force: yes force: yes
with_items: with_items:
- "{{ awstats_data_dir }}" - "{{ awstats_data_dir }}"
- "{{ apache_log_dir }}" - "{{ apache_log_dir }}"
- /usr/lib/cgi-bin/awstats # create backward compatible path for awstats - /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: template:
src: "{{ item.src }}" src: apache-awstats.conf
dest: "{{ item.dest }}" dest: "/etc/{{ apache_config_dir }}/awstats.conf"
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) - name: Install /etc/logrotate.d/apache2 from template, to ensure logrotate doesn't make logs unreadable
template: template:
src: logrotate.d.apache2 src: logrotate.d.apache2
dest: /etc/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: stat:
path: /etc/awstats/awstats.conf path: /etc/awstats/awstats.conf
register: awstats register: awstats
@ -62,37 +49,34 @@
command: mv /etc/awstats/awstats.conf /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 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: file:
src: /usr/lib/cgi-bin/awstats.pl src: /usr/lib/cgi-bin/awstats.pl
path: /usr/lib/cgi-bin/awstats/awstats.pl path: /usr/lib/cgi-bin/awstats/awstats.pl
state: link state: link
- name: Install /etc/awstats/awstats.schoolserver.conf - name: Install /etc/awstats/awstats.schoolserver.conf from template
template: template:
src: awstats.schoolserver.conf.j2 src: awstats.schoolserver.conf.j2
dest: /etc/awstats/awstats.schoolserver.conf dest: /etc/awstats/awstats.schoolserver.conf
owner: root # when: awstats_enabled | bool
group: root
mode: 0644
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: file:
src: /etc/awstats/awstats.schoolserver.conf src: /etc/awstats/awstats.schoolserver.conf
path: /etc/awstats/awstats.conf path: /etc/awstats/awstats.conf
state: link 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) # - 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 # shell: /bin/perl /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=schoolserver -update
when: awstats_enabled and not is_debuntu # 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 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: lineinfile:
dest: "{{ iiab_state_file }}" dest: "{{ iiab_state_file }}"
regexp: '^awstats_installed' regexp: '^awstats_installed'