1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00

Merge pull request #670 from holta/awstats

AWStats indentation/syntax per new Ansible documentation
This commit is contained in:
A Holt 2018-02-11 17:34:22 -05:00 committed by GitHub
commit ed1690373d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 55 additions and 44 deletions

View file

@ -1,6 +1,7 @@
- name: Install AWStats package - name: Install AWStats package
package: name={{ item }} package:
state=present name: "{{ item }}"
state: present
with_items: with_items:
- awstats - awstats
- pwauth - pwauth
@ -9,8 +10,9 @@
- download - download
- name: Install AWStats package (debuntu) - name: Install AWStats package (debuntu)
package: name={{ item }} package:
state=present name: "{{ item }}"
state: present
with_items: with_items:
- libapache2-mod-authnz-external - libapache2-mod-authnz-external
- apache2-utils - apache2-utils
@ -18,74 +20,82 @@
tags: tags:
- download - download
- name: enable cgi execution (debuntu) - name: Enable cgi execution (debuntu)
command: a2enmod cgi command: a2enmod cgi
when: is_debuntu when: is_debuntu
- name: Create directory for AWStats to use as intermediate summary storage - name: Create directory for AWStats to use as intermediate summary storage
file: path={{ item }} file:
mode=0750 path: "{{ item }}"
owner={{ apache_user }} mode: 0750
group={{ apache_user }} owner: "{{ apache_user }}"
state=directory group: "{{ apache_user }}"
force=true state: directory
force: true
with_items: with_items:
- "{{ awstats_data_dir }}" - "{{ awstats_data_dir }}"
- "{{ apache_log_dir }}" - "{{ apache_log_dir }}"
- name: Install the Apache config for AWStats (debuntu) - name: Install the Apache config for AWStats (debuntu)
template: src=apache.conf template:
dest=/etc/{{ apache_config_dir }}/awstats.conf src: apache.conf
owner=root dest: "/etc/{{ apache_config_dir }}/awstats.conf"
group=root owner: root
mode=0644 group: root
mode: 0644
when: awstats_enabled and is_debuntu when: awstats_enabled and is_debuntu
- name: Install the Apache config for AWStats (OS's other than debuntu) - name: Install the Apache config for AWStats (OS's other than debuntu)
template: src=apache-awstats.conf template:
dest=/etc/{{ apache_config_dir }}/awstats.conf src: apache-awstats.conf
owner=root dest: "/etc/{{ apache_config_dir }}/awstats.conf"
group=root owner: root
mode=0644 group: root
mode: 0644
when: awstats_enabled and not is_debuntu when: awstats_enabled and not is_debuntu
- name: make sure logrotate does not make logs unreadable (debuntu) - name: Make sure logrotate does not make logs unreadable (debuntu)
template: src=logrotate.d.apache2 template:
dest=/etc/logrotate.d/apache2 src: logrotate.d.apache2
dest: /etc/logrotate.d/apache2
when: is_debuntu when: is_debuntu
- name: See if awstats package installed a config file - name: See if AWStats package installed a config file
stat: path=/etc/awstats/awstats.conf stat:
path: /etc/awstats/awstats.conf
register: awstats register: awstats
- name: If there was a config file installed by package, move it aside - name: If there was a config file installed by package, move it aside
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: Enable AWStats (debuntu) - name: Enable AWStats (debuntu)
file: src=/etc/apache2/sites-available/awstats.conf file:
path=/etc/apache2/sites-enabled/awstats.conf src: /etc/apache2/sites-available/awstats.conf
state=link path: /etc/apache2/sites-enabled/awstats.conf
state: link
when: awstats_enabled and is_debuntu when: awstats_enabled and is_debuntu
- name: Disable AWStats (debuntu) - name: Disable AWStats (debuntu)
file: path=/etc/apache2/sites-enabled/awstats.conf file:
state=absent path: /etc/apache2/sites-enabled/awstats.conf
state: absent
when: not awstats_enabled and is_debuntu when: not awstats_enabled and is_debuntu
- name: Install the AWStats config - name: Install the AWStats config
template: src=awstats.schoolserver.conf.j2 template:
dest=/etc/awstats/awstats.schoolserver.conf src: awstats.schoolserver.conf.j2
owner=root dest: /etc/awstats/awstats.schoolserver.conf
group=root owner: root
mode=0644 group: root
mode: 0644
when: awstats_enabled when: awstats_enabled
- name: Create a symbolic link to use when access is by IP address - name: Create a symbolic link to use when access is by IP address
file: src=/etc/awstats/awstats.schoolserver.conf file:
dest=/etc/awstats/awstats.conf src: /etc/awstats/awstats.schoolserver.conf
state=link dest: /etc/awstats/awstats.conf
state: link
when: awstats_enabled when: awstats_enabled
- 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)

View file

@ -2,10 +2,11 @@
when: awstats_install when: awstats_install
- name: Add 'awstats' to list of services at /etc/iiab/iiab.ini - name: Add 'awstats' to list of services at /etc/iiab/iiab.ini
ini_file: dest='{{ service_filelist }}' ini_file:
section=awstats dest: "{{ service_filelist }}"
option='{{ item.option }}' section: awstats
value='{{ item.value }}' option: "{{ item.option }}"
value: "{{ item.value }}"
with_items: with_items:
- option: name - option: name
value: AWStats value: AWStats